forked from mirrors/gstreamer-rs
examples: manually destroy the GTK window when shutting down
Make the leaks tracer happy, allowing us to detect actual leaks. Fix #341
This commit is contained in:
parent
37a352dc35
commit
7c592a5b9b
2 changed files with 14 additions and 0 deletions
|
@ -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<Option<_>> and removing it from it here
|
||||
// ensures the pipeline is actually destroyed when shutting down, allowing us
|
||||
|
|
|
@ -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<Option<_>> and removing it from it here
|
||||
// ensures the pipeline is actually destroyed when shutting down, allowing us
|
||||
|
|
Loading…
Reference in a new issue