G_ADD_PRIVATE() should mention what to do when G_DEFINE_TYPE can't be used
g_type_class_add_private() is obsolete, and the recommended replacement is using
G_ADD_PRIVATE() needs to be used with
G_DEFINE_TYPE*() macros, which isn't possible in some situations, like when a class
finalize() function is needed.
Would a note like this in the
G_ADD_PRIVATE() documentation do?
diff --git a/gobject/gtype.h b/gobject/gtype.h index 797ab48ee..9f76aeaf8 100644 --- a/gobject/gtype.h +++ b/gobject/gtype.h @@ -1882,6 +1882,10 @@ guint g_type_get_type_registration_serial (void); * Note that this macro can only be used together with the G_DEFINE_TYPE_* * macros, since it depends on variable names from those macros. * + * If your code does not and cannot use the G_DEFINE_TYPE_* macros, then + * the best would be to create your private struct by hand, using g_new0() + * during _init() and free()'ing during _finalize(). + * * Also note that private structs added with these macros must have a struct * name of the form `TypeNamePrivate`. *