gobject: add internal g_destroy_notify_assert_not_reached() helper

This is a GDestoryNotify that asserts not to be called. Obviously, this
is only for testing and asserting (defensive programming).

It is private API inside "libgobject-2.0.so.0". If unused, we rely that
the linker can strip it out.
This commit is contained in:
Thomas Haller
2025-03-12 08:26:42 +01:00
parent dec3ba69e8
commit 4845314c01
2 changed files with 8 additions and 0 deletions

View File

@@ -99,6 +99,8 @@ gboolean _g_object_has_signal_handler (GObject *object);
void _g_object_set_has_signal_handler (GObject *object,
guint signal_id);
void g_destroy_notify_assert_not_reached (gpointer object);
/**
* _G_DEFINE_TYPE_EXTENDED_WITH_PRELUDE:
*

View File

@@ -4848,3 +4848,9 @@ g_type_ensure (GType type)
if (G_UNLIKELY (type == (GType)-1))
g_error ("can't happen");
}
void
g_destroy_notify_assert_not_reached (gpointer object)
{
g_return_if_reached ();
}