diff options
author | Göran Jönsson <goranjn@axis.com> | 2014-06-23 11:53:11 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2014-07-01 19:41:36 +0200 |
commit | e050541f11711d2ff8edf4b80213acffbdba7a07 (patch) | |
tree | 48975f562ad11a035817035472b56aa83dc5edfd /gst | |
parent | 2a7c05592d015241cb0f076a82da36ccdbbc6c2f (diff) | |
download | gstreamer-plugins-bad-e050541f11711d2ff8edf4b80213acffbdba7a07.tar.gz |
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
Diffstat (limited to 'gst')
-rw-r--r-- | gst/debugutils/gstwatchdog.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/gst/debugutils/gstwatchdog.c b/gst/debugutils/gstwatchdog.c index e844af79f..eb77765f3 100644 --- a/gst/debugutils/gstwatchdog.c +++ b/gst/debugutils/gstwatchdog.c @@ -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); } } |