[glibmm] giomm: AsyncInitiable: Correct errors.



commit fa7ddca42b0a63cd57efdf336bae8e6a04e4c3f4
Author: José Alburquerque <jaalburqu svn gnome org>
Date:   Tue Aug 31 01:27:12 2010 -0400

    	giomm: AsyncInitiable: Correct errors.
    
    	* gio/src/asyncinitable.ccg (init_async_vfunc_callback): Take an extra
    	reference of the cancellable when calling the member virtual method so
    	the cancellable is not destroyed.
    	(init_async_vfunc): Don't create a copy of the SlotAsyncReady because
    	it would have already been copied in init_async() method invocation.

 ChangeLog                 |   10 ++++++++++
 gio/src/asyncinitable.ccg |   15 ++++++---------
 2 files changed, 16 insertions(+), 9 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c82b425..5b13a39 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2010-08-31  José Alburquerque  <jaalburqu svn gnome org>
+
+	giomm: AsyncInitiable: Correct errors.
+
+	* gio/src/asyncinitable.ccg (init_async_vfunc_callback): Take an extra
+	reference of the cancellable when calling the member virtual method so
+	the cancellable is not destroyed.
+	(init_async_vfunc): Don't create a copy of the SlotAsyncReady because
+	it would have already been copied in init_async() method invocation.
+
 2010-08-30  José Alburquerque  <jaalburqu svn gnome org>
 
 	giomm: AsyncInitable: Wrap virtual functions.
diff --git a/gio/src/asyncinitable.ccg b/gio/src/asyncinitable.ccg
index 6b9de1e..4dc8d8a 100644
--- a/gio/src/asyncinitable.ccg
+++ b/gio/src/asyncinitable.ccg
@@ -68,12 +68,13 @@ void AsyncInitable_Class::init_async_vfunc_callback(GAsyncInitable* self,
       try // Trap C++ exceptions which would normally be lost because this is a C callback.
       {
       #endif //GLIBMM_EXCEPTIONS_ENABLED
-        // Call the virtual member method, which derived classes might override.
         // Get the slot.
         Gio::SlotAsyncReady* the_slot =
           static_cast<Gio::SlotAsyncReady*>(user_data);
 
-        obj->init_async_vfunc(*the_slot, Glib::wrap(cancellable), io_priority);
+        // Call the virtual member method, which derived classes might override.
+        obj->init_async_vfunc(*the_slot, Glib::wrap(cancellable, true),
+          io_priority);
         return;
       #ifdef GLIBMM_EXCEPTIONS_ENABLED
       }
@@ -105,17 +106,13 @@ g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) /
 
   if(base && base->init_async)
   {
-    // Create a copy of the slot.
-    // A pointer to it will be passed through the callback's data parameter
-    // and deleted in the callback.
-    SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
-
     (*base->init_async)(gobj(), io_priority,
       const_cast<GCancellable*>(Glib::unwrap(cancellable)),
-      &SignalProxy_async_callback, slot_copy);
+      &SignalProxy_async_callback, const_cast<SlotAsyncReady*>(&slot));
   }
 }
-gboolean AsyncInitable_Class::init_finish_vfunc_callback(GAsyncInitable* self, GAsyncResult* res, GError** error)
+gboolean AsyncInitable_Class::init_finish_vfunc_callback(GAsyncInitable* self,
+  GAsyncResult* res, GError** error)
 {
   Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
       Glib::ObjectBase::_get_current_wrapper((GObject*)self));



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