[glibmm/glibmm-2-60] Gio::DBus::Object::get_interface_vfunc(): Don't add global symbol



commit fec4eabc90507031dddae0f3e9883d3dfc95db26
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Wed Jul 17 20:23:33 2019 +0200

    Gio::DBus::Object::get_interface_vfunc(): Don't add global symbol
    
    The previous fix of Gio::DBus::Object vfuncs added a Glib::unwrap_copy()
    overload, which became a global symbol in the load module. Replace it
    with a local name in an anonymous namespace.

 gio/src/dbusobject.ccg | 9 +++------
 gio/src/dbusobject.hg  | 5 ++++-
 2 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/gio/src/dbusobject.ccg b/gio/src/dbusobject.ccg
index eb1432da..69d4b58a 100644
--- a/gio/src/dbusobject.ccg
+++ b/gio/src/dbusobject.ccg
@@ -25,15 +25,12 @@ void* list_copy_ref(const void* src, void* /* data */)
 {
   return g_object_ref(const_cast<void*>(src));
 }
-} // anonymous namespace
 
-namespace Glib
-{
-// Define a unwrap_copy() overload.
+// Define a replacement for Glib::unwrap_copy().
 // Can't use the template function in glibmm/wrap.h, because interface classes
 // don't override Glib::ObjectBase::gobj_copy(), which returns a GObject*.
-GDBusInterface* unwrap_copy(const Glib::RefPtr<Gio::DBus::Interface>& ptr)
+GDBusInterface* local_unwrap_copy(const Glib::RefPtr<Gio::DBus::Interface>& ptr)
 {
   return ptr ? reinterpret_cast<GDBusInterface*>(ptr->gobj_copy()) : nullptr;
 }
-} // namespace Glib
+} // anonymous namespace
diff --git a/gio/src/dbusobject.hg b/gio/src/dbusobject.hg
index bc04a6fb..9618aa52 100644
--- a/gio/src/dbusobject.hg
+++ b/gio/src/dbusobject.hg
@@ -72,7 +72,10 @@ public:
 #m4  `g_list_copy_deep(Glib::ListHandler<Glib::RefPtr<Gio::DBus::Interface>>::vector_to_list($3).data(), 
list_copy_ref, nullptr)')
   _WRAP_VFUNC(std::vector<Glib::RefPtr<Gio::DBus::Interface>> get_interfaces() const, "get_interfaces")
 
-  _WRAP_VFUNC(Glib::RefPtr<Gio::DBus::Interface> get_interface(const Glib::ustring& interface_name) const, 
"get_interface", refreturn_ctype)
+  // Can't use refreturn_ctype here. It generates a call to Glib::unwrap_copy(), which
+  // can't be used for Glib::Interface classes. They have no gobj_copy() method.
+#m4 _CONVERSION(`Glib::RefPtr<Gio::DBus::Interface>',`GDBusInterface*',`local_unwrap_copy($3)')
+  _WRAP_VFUNC(Glib::RefPtr<Gio::DBus::Interface> get_interface(const Glib::ustring& interface_name) const, 
"get_interface")
 };
 
 } // namespace DBus


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