gio: don't use soon-to-be-deprecated g_cancellable_reset()
authorTim-Philipp Müller <tim@centricular.com>
Fri, 24 Oct 2014 16:49:23 +0000 (17:49 +0100)
committerTim-Philipp Müller <tim@centricular.com>
Tue, 19 May 2015 17:52:41 +0000 (18:52 +0100)
From the API documentation: "Note that it is generally not
a good idea to reuse an existing cancellable for more
operations after it has been cancelled once, as this
function might tempt you to do. The recommended practice
is to drop the reference to a cancellable after cancelling
it, and let it die with the outstanding async operations.
You should create a fresh cancellable for further async
operations."

https://bugzilla.gnome.org/show_bug.cgi?id=739132

gst/gio/gstgiobasesink.c
gst/gio/gstgiobasesrc.c

index d50e8aa..3dbec56 100644 (file)
@@ -191,7 +191,8 @@ gst_gio_base_sink_unlock_stop (GstBaseSink * base_sink)
 
   GST_LOG_OBJECT (sink, "resetting cancellable");
 
-  g_cancellable_reset (sink->cancel);
+  g_object_unref (sink->cancel);
+  sink->cancel = g_cancellable_new ();
 
   return TRUE;
 }
index 0ffe01a..213ede6 100644 (file)
@@ -286,7 +286,8 @@ gst_gio_base_src_unlock_stop (GstBaseSrc * base_src)
 
   GST_LOG_OBJECT (src, "resetting cancellable");
 
-  g_cancellable_reset (src->cancel);
+  g_object_unref (src->cancel);
+  src->cancel = g_cancellable_new ();
 
   return TRUE;
 }