Skip to content

Commit

Permalink
memory leak fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lmaxyz committed Feb 10, 2024
1 parent f819156 commit 0a0113c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/graphics_capture_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,11 +367,14 @@ impl GraphicsCaptureApi {
impl Drop for GraphicsCaptureApi {
fn drop(&mut self) {
if let Some(frame_pool) = self.frame_pool.take() {
frame_pool.RemoveFrameArrived(self.frame_arrived_event_token).expect("Failed to remove Frame Arrived event handler");
frame_pool.Close().expect("Failed to Close Frame Pool");
}

if let Some(session) = self.session.take() {
session.Close().expect("Failed to Close Capture Session");
}

self.item.RemoveClosed(self.capture_closed_event_token).expect("Failed to remove Capture Session Closed event handler");
}
}

0 comments on commit 0a0113c

Please sign in to comment.