[gstreamermm] fixed query vfunc wrapper - it should not unref query object



commit cfa4d3a6274d93f406be7b77600eb7f1aa04f6e3
Author: Tomasz Lakota <tomasz lakota flytronic pl>
Date:   Mon Mar 24 18:31:22 2014 +0100

    fixed query vfunc wrapper - it should not unref query object
    
    Conflicts:
        gstreamer/gstreamermm/pad.cc

 gstreamer/src/pad.ccg |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/gstreamer/src/pad.ccg b/gstreamer/src/pad.ccg
index 0ada720..e499f50 100644
--- a/gstreamer/src/pad.ccg
+++ b/gstreamer/src/pad.ccg
@@ -204,9 +204,15 @@ gboolean Pad_Query_gstreamermm_callback(GstPad* pad, GstObject* parent, GstQuery
 
   try
   {
+    //We cannot make copy of query, since some elements fail to answer the query if it's refcount>1 (is not 
writtable)
     Glib::RefPtr<Query> query_wrapped = Glib::wrap(query, false);
 
-    return pad_wrapper->slot_query(Glib::wrap(pad, true), query_wrapped);
+    gboolean res = pad_wrapper->slot_query(Glib::wrap(pad, true), query_wrapped);
+    
+    //we have to increase refcount, since freeing RefPtr will decrease it which would be inaccurate here, 
since the
+    //caller is responsible for managing the object (see "transfer none" on this parameter)
+    query_wrapped->reference();
+    return res;
   }
   catch(...)
   {
@@ -227,6 +233,7 @@ gboolean Pad_Event_gstreamermm_callback(GstPad* pad, GstObject* parent, GstEvent
 
   try
   {
+    //we don't make copy, since ownership is transfered to the callee ("transfer full")
     Glib::RefPtr<Event> event_wrapped = Glib::wrap(event, false);
 
     return pad_wrapper->slot_event(Glib::wrap(pad, true), event_wrapped);


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