summaryrefslogtreecommitdiff
path: root/glib/glibmm/objectbase.cc
diff options
context:
space:
mode:
authorKjell Ahlstedt <kjellahlstedt@gmail.com>2023-03-31 15:24:13 +0200
committerKjell Ahlstedt <kjellahlstedt@gmail.com>2023-03-31 15:24:13 +0200
commit98f3b67b5c1bd71d0e7b41193fb4683fc957e321 (patch)
tree1fa8a4cf1bf9a93a79bfe08be83426bb15da01e9 /glib/glibmm/objectbase.cc
parentb7ad9b86d70003c065606c563578cc66dcd2ce0a (diff)
downloadglibmm-2-76.tar.gz
Glib: Use callback functions with C linkageglibmm-2-76
* gio/src/cancellable.ccg: Add TODO comment. * glib/glibmm/class.cc: Call custom_class_base_finalize_function() and custom_class_init_function() via local functions with C linkage. * glib/glibmm/extraclassinit.h: Point out in the class documentation that the class init and instance init functions shall have C linkage. * glib/glibmm/main.[cc|h]: Call prepare_vfunc(), check_vfunc() and dispatch_vfunc() via local functions with C linkage. * glib/glibmm/objectbase.cc: Call destroy_notify_callback() via a local function with C linkage. * glib/glibmm/propertyproxy_base.cc: Call PropertyProxyConnectionNode:: callback() and destroy_notify_handler() via local functions with C linkage. * glib/glibmm/signalproxy.cc: Call SignalProxyNormal::slot0_void_callback() and SignalProxyConnectionNode::destroy_notify_handler() via local functions with C linkage. * glib/src/binding.ccg: Add extern "C". * glib/src/bytearray.ccg: Add a TODO comment. * glib/src/markup.ccg: Call functions in the vfunc table via local functions with C linkage. * glib/src/optioncontext.ccg: Add extern "C". * glib/src/optiongroup.ccg: Call post_parse_callback() and option_arg_callback() via local functions with C linkage. Part of issue #1
Diffstat (limited to 'glib/glibmm/objectbase.cc')
-rw-r--r--glib/glibmm/objectbase.cc17
1 files changed, 15 insertions, 2 deletions
diff --git a/glib/glibmm/objectbase.cc b/glib/glibmm/objectbase.cc
index f23c4977..84067f8c 100644
--- a/glib/glibmm/objectbase.cc
+++ b/glib/glibmm/objectbase.cc
@@ -32,6 +32,18 @@ namespace
static const char anonymous_custom_type_name[] = "gtkmm__anonymous_custom_type";
+using ObjectBaseDestroyNotifyFuncType = void (*)(void* data);
+ObjectBaseDestroyNotifyFuncType ObjectBase_destroy_notify_funcptr;
+
+// From function with C linkage, to protected static member function with C++ linkage
+extern "C"
+{
+static void ObjectBase_destroy_notify_callback(void* data)
+{
+ ObjectBase_destroy_notify_funcptr(data);
+}
+} // extern "C"
+
} // anonymous namespace
namespace Glib
@@ -219,7 +231,8 @@ ObjectBase::_set_current_wrapper(GObject* object)
{
if (!g_object_get_qdata(object, Glib::quark_))
{
- g_object_set_qdata_full(object, Glib::quark_, this, &destroy_notify_callback_);
+ ObjectBase_destroy_notify_funcptr = &destroy_notify_callback_;
+ g_object_set_qdata_full(object, Glib::quark_, this, &ObjectBase_destroy_notify_callback);
}
else
{
@@ -247,7 +260,7 @@ ObjectBase::_move_current_wrapper(GObject* object, Glib::ObjectBase* previous_wr
g_object_steal_qdata(object, Glib::quark_);
// Set the new wrapper:
- g_object_set_qdata_full(object, Glib::quark_, this, &destroy_notify_callback_);
+ g_object_set_qdata_full(object, Glib::quark_, this, &ObjectBase_destroy_notify_callback);
// Clear the previous wrapper:
previous_wrapper->gobject_ = nullptr;