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
@ -215,10 +215,10 @@ gst_watchdog_feed (GstWatchdog * watchdog)
|
|||||||
watchdog->source = NULL;
|
watchdog->source = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (watchdog->timeout != 0) {
|
if (watchdog->timeout != 0 && watchdog->main_context) {
|
||||||
watchdog->source = g_timeout_source_new (watchdog->timeout);
|
watchdog->source = g_timeout_source_new (watchdog->timeout);
|
||||||
g_source_set_callback (watchdog->source, gst_watchdog_trigger, watchdog,
|
g_source_set_callback (watchdog->source, gst_watchdog_trigger, gst_object_ref (watchdog),
|
||||||
NULL);
|
gst_object_unref);
|
||||||
g_source_attach (watchdog->source, watchdog->main_context);
|
g_source_attach (watchdog->source, watchdog->main_context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user