diff options
author | José Alburquerque <jaalburqu@svn.gnome.org> | 2010-08-31 01:27:12 -0400 |
---|---|---|
committer | José Alburquerque <jaalburqu@svn.gnome.org> | 2010-08-31 01:35:14 -0400 |
commit | fa7ddca42b0a63cd57efdf336bae8e6a04e4c3f4 (patch) | |
tree | 40ea072bc904bc8c4921a454bbb3fc39547093f4 | |
parent | d240f079614fe024047891f89d5625c50f110123 (diff) | |
download | glibmm-fa7ddca42b0a63cd57efdf336bae8e6a04e4c3f4.tar.gz |
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.
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | gio/src/asyncinitable.ccg | 15 |
2 files changed, 16 insertions, 9 deletions
@@ -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 6b9de1ed..4dc8d8a3 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)); |