diff --git a/examples/src/bin/gtksink.rs b/examples/src/bin/gtksink.rs index 92a491c60..b766d7f1f 100644 --- a/examples/src/bin/gtksink.rs +++ b/examples/src/bin/gtksink.rs @@ -136,6 +136,13 @@ fn create_ui(app: >k::Application) { let timeout_id = RefCell::new(Some(timeout_id)); let pipeline = RefCell::new(Some(pipeline)); app.connect_shutdown(move |_| { + // Optional, by manually destroying the window here we ensure that + // the gst element is destroyed when shutting down instead of having to wait + // for the process to terminate, allowing us to use the leaks tracer. + unsafe { + window.destroy(); + } + // GTK will keep the Application alive for the whole process lifetime. // Wrapping the pipeline in a RefCell> and removing it from it here // ensures the pipeline is actually destroyed when shutting down, allowing us diff --git a/examples/src/bin/gtkvideooverlay.rs b/examples/src/bin/gtkvideooverlay.rs index 52ffdd51c..e49a29943 100644 --- a/examples/src/bin/gtkvideooverlay.rs +++ b/examples/src/bin/gtkvideooverlay.rs @@ -241,6 +241,13 @@ fn create_ui(app: >k::Application) { let timeout_id = RefCell::new(Some(timeout_id)); let pipeline = RefCell::new(Some(pipeline)); app.connect_shutdown(move |_| { + // Optional, by manually destroying the window here we ensure that + // the gst element is destroyed when shutting down instead of having to wait + // for the process to terminate, allowing us to use the leaks tracer. + unsafe { + window.destroy(); + } + // GTK will keep the Application alive for the whole process lifetime. // Wrapping the pipeline in a RefCell> and removing it from it here // ensures the pipeline is actually destroyed when shutting down, allowing us