summaryrefslogtreecommitdiff
path: root/glib
diff options
context:
space:
mode:
Diffstat (limited to 'glib')
-rw-r--r--glib/glibmm/class.cc9
-rw-r--r--glib/glibmm/interface.cc7
2 files changed, 16 insertions, 0 deletions
diff --git a/glib/glibmm/class.cc b/glib/glibmm/class.cc
index 36c3c4be..31f92c61 100644
--- a/glib/glibmm/class.cc
+++ b/glib/glibmm/class.cc
@@ -42,6 +42,15 @@ Class::register_derived_type(GType base_type, GTypeModule* module)
if (base_type == 0)
return; // already initialized
+#if GLIB_CHECK_VERSION(2,70,0)
+ // Don't derive a type if the base type is a final type.
+ if (G_TYPE_IS_FINAL(base_type))
+ {
+ gtype_ = base_type;
+ return;
+ }
+#endif
+
GTypeQuery base_query = {
0, nullptr, 0, 0,
};
diff --git a/glib/glibmm/interface.cc b/glib/glibmm/interface.cc
index f01f13dc..eec50e3a 100644
--- a/glib/glibmm/interface.cc
+++ b/glib/glibmm/interface.cc
@@ -25,6 +25,13 @@ namespace Glib
void
Interface_Class::add_interface(GType instance_type) const
{
+#if GLIB_CHECK_VERSION(2,70,0)
+ // If instance_type is a final type, it has not been registered by
+ // Glib::Class::register_derived_type(). Don't add an interface.
+ if (G_TYPE_IS_FINAL(instance_type))
+ return;
+#endif
+
// This check is disabled, because it checks whether any of the types's bases implement the
// interface, not just the specific type.
// if( !g_type_is_a(instance_type, gtype_) ) //For convenience, don't complain about calling this