mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-22 09:31:06 +00:00
Add a function to unset the Bus' current sync handler
And use it in the Tokio example to unset the handler once the BusStream is dropped.
This commit is contained in:
parent
7e079e927d
commit
23ef3c1f08
2 changed files with 18 additions and 0 deletions
|
@ -32,6 +32,12 @@ impl BusStream {
|
|||
}
|
||||
}
|
||||
|
||||
impl Drop for BusStream {
|
||||
fn drop(&mut self) {
|
||||
self.0.unset_sync_handler();
|
||||
}
|
||||
}
|
||||
|
||||
impl Stream for BusStream {
|
||||
type Item = Message;
|
||||
type Error = ();
|
||||
|
|
|
@ -14,6 +14,7 @@ use glib::translate::*;
|
|||
use glib::source::{CallbackGuard, Continue, Priority, SourceId};
|
||||
use glib_ffi;
|
||||
use glib_ffi::{gboolean, gpointer};
|
||||
use std::ptr;
|
||||
|
||||
use Bus;
|
||||
use BusSyncReply;
|
||||
|
@ -119,4 +120,15 @@ impl Bus {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn unset_sync_handler(&self) {
|
||||
unsafe {
|
||||
ffi::gst_bus_set_sync_handler(
|
||||
self.to_glib_none().0,
|
||||
None,
|
||||
ptr::null_mut(),
|
||||
None,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue