summaryrefslogtreecommitdiff
path: root/gio
diff options
context:
space:
mode:
authorKjell Ahlstedt <kjellahlstedt@gmail.com>2019-01-25 16:57:19 +0100
committerKjell Ahlstedt <kjellahlstedt@gmail.com>2019-01-25 16:57:19 +0100
commitee64cd329725218231e5b1bade01c998482f5da7 (patch)
treed610cbbdcc864a1f3fa427b1cba98b2a1279c71d /gio
parent96a997b1f4cf902a7690de8a27e1173f1d217042 (diff)
downloadglibmm-ee64cd329725218231e5b1bade01c998482f5da7.tar.gz
Gio::AsyncResult: Explain why wrap() is not used in get_source_object_base()
* gio/src/asyncresult.ccg: Replace a TODO comment with an explanation. * tests/giomm_asyncresult_sourceobject/main.cc: Add code that demonstrates why Glib::wrap(GObject* object, bool take_copy) returns an empty RefPtr.
Diffstat (limited to 'gio')
-rw-r--r--gio/src/asyncresult.ccg6
1 files changed, 5 insertions, 1 deletions
diff --git a/gio/src/asyncresult.ccg b/gio/src/asyncresult.ccg
index 8f1a0128..5570bbaf 100644
--- a/gio/src/asyncresult.ccg
+++ b/gio/src/asyncresult.ccg
@@ -30,11 +30,15 @@ unwrap_objectbase_custom(const Glib::RefPtr<Glib::ObjectBase>& cpp_instance)
Glib::RefPtr<Glib::ObjectBase>
AsyncResult::get_source_object_base()
{
+ // Glib::wrap(cobj) can't be used here. See tests/giomm_asyncresult_sourceobject
+ // for a case where it would fail, and an explanation of why.
+ // In short, the source object is not necessarily a Glib::Object. It may be
+ // a Glib::Interface.
+
auto cobj = g_async_result_get_source_object(gobj());
auto cppobj = Glib::wrap_auto(cobj); // ObjectBase::_get_current_wrapper(cobj);
return Glib::make_refptr_for_instance<Glib::ObjectBase>(
cppobj); // g_async_result_get_source_object() gives us a ref, unusually.
- // TODO: For some reason this fails: Glib::wrap(cobj);
}
Glib::RefPtr<const Glib::ObjectBase>