mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 01:30:38 +00:00
watchdog: Only create a new GSource if we have a main context
We can still get OOB events while stopping the watchdog element, and while stopping it we destroy the main context. Also let the GSource own a reference to the element for additional safety. https://bugzilla.gnome.org/show_bug.cgi?id=732554
This commit is contained in:
parent
2a7c05592d
commit
e050541f11
1 changed files with 3 additions and 3 deletions
|
@ -215,10 +215,10 @@ gst_watchdog_feed (GstWatchdog * watchdog)
|
|||
watchdog->source = NULL;
|
||||
}
|
||||
|
||||
if (watchdog->timeout != 0) {
|
||||
if (watchdog->timeout != 0 && watchdog->main_context) {
|
||||
watchdog->source = g_timeout_source_new (watchdog->timeout);
|
||||
g_source_set_callback (watchdog->source, gst_watchdog_trigger, watchdog,
|
||||
NULL);
|
||||
g_source_set_callback (watchdog->source, gst_watchdog_trigger, gst_object_ref (watchdog),
|
||||
gst_object_unref);
|
||||
g_source_attach (watchdog->source, watchdog->main_context);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue