[clutter-gst] sink: Make the sink hold a weak reference to the ClutterTexture



commit ddbb091b4a4d4cce0f3b324819af975a246faf4d
Author: Damien Lespiau <damien lespiau intel com>
Date:   Thu Oct 27 19:23:41 2011 +0100

    sink: Make the sink hold a weak reference to the ClutterTexture
    
    The sink does not need to hold a reference to the Texture, it better to
    leave the life cycle of the ClutterTexture entirely to Clutter.
    
    If the texture disapears when the sink is still live and pushing buffers
    to it, you will get warnings not nothing dramatic. It's your
    responsibility to ensure the GStreamer pipeline has been stopped when
    removing/destroying the texture.

 clutter-gst/clutter-gst-video-sink.c      |    3 +--
 tests/test-video-texture-new-unref-loop.c |    3 ---
 2 files changed, 1 insertions(+), 5 deletions(-)
---
diff --git a/clutter-gst/clutter-gst-video-sink.c b/clutter-gst/clutter-gst-video-sink.c
index 22a5a2f..2d15455 100644
--- a/clutter-gst/clutter-gst-video-sink.c
+++ b/clutter-gst/clutter-gst-video-sink.c
@@ -1189,7 +1189,6 @@ clutter_gst_video_sink_set_texture (ClutterGstVideoSink *sink,
           g_signal_handler_disconnect (priv->texture, id);
         }
       g_array_set_size (priv->signal_handler_ids, 0);
-      g_object_unref (priv->texture);
     }
 
   priv->texture = texture;
@@ -1219,7 +1218,7 @@ clutter_gst_video_sink_set_property (GObject *object,
   switch (prop_id)
     {
     case PROP_TEXTURE:
-      clutter_gst_video_sink_set_texture (sink, g_value_dup_object (value));
+      clutter_gst_video_sink_set_texture (sink, g_value_get_object (value));
       break;
     case PROP_UPDATE_PRIORITY:
       clutter_gst_video_sink_set_priority (sink, g_value_get_int (value));
diff --git a/tests/test-video-texture-new-unref-loop.c b/tests/test-video-texture-new-unref-loop.c
index 3ff89e5..10ba16e 100644
--- a/tests/test-video-texture-new-unref-loop.c
+++ b/tests/test-video-texture-new-unref-loop.c
@@ -44,11 +44,8 @@ main (int argc, char *argv[])
   {
     g_debug("VideoTexure #%d", i);
     vtexture = clutter_gst_video_texture_new();
-    if (vtexture == NULL)
-      g_error("failed to create VideoTexture");
     g_object_ref_sink (vtexture);
     g_object_unref (vtexture);
-    g_object_unref (vtexture);
   }
 
   return EXIT_SUCCESS;



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