[grilo-plugins] youtube: Fix an unpaired unref of a GCancellable when searching



commit be522d118102539abb93abac70b48db00dd75823
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Fri Sep 4 14:43:31 2015 +0100

    youtube: Fix an unpaired unref of a GCancellable when searching
    
    The GCancellable stored in grl_operation_set_data() is unconditionally
    unreffed by release_operation_data(); but is also unconditionally
    unreffed elsewhere if it’s set as os->cancellable, so needs a second ref
    in the grl_operation_set_data() call to avoid a double-unref and crash.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=754244

 src/youtube/grl-youtube.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/youtube/grl-youtube.c b/src/youtube/grl-youtube.c
index 246c8a3..e085272 100644
--- a/src/youtube/grl-youtube.c
+++ b/src/youtube/grl-youtube.c
@@ -1071,7 +1071,7 @@ produce_from_feed (OperationSpec *os)
   operation_spec_ref (os);
 
   os->cancellable = g_cancellable_new ();
-  grl_operation_set_data (os->operation_id, os->cancellable);
+  grl_operation_set_data (os->operation_id, g_object_ref (os->cancellable));
 
   service = GRL_YOUTUBE_SOURCE (os->source)->priv->service;
 
@@ -1314,7 +1314,7 @@ grl_youtube_source_search (GrlSource *source,
   /* Look for OPERATION_SPEC_REF_RATIONALE for details */
   operation_spec_ref (os);
 
-  grl_operation_set_data (ss->operation_id, os->cancellable);
+  grl_operation_set_data (ss->operation_id, g_object_ref (os->cancellable));
 
   /* Index in GData starts at 1 */
   query = gdata_youtube_query_new (ss->text);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]