libgimpwidgets: do not free the GtkAdjustment when finalizing...792b27afe19b75585c272fa639acc3c75b6edba9
commit792b27afe19b75585c272fa639acc3c75b6edba9
authorJehan <jehan@girinstud.io>
Sun, 24 Jun 2018 21:16:58 +0000 (24 23:16 +0200)
committerJehan <jehan@girinstud.io>
Sun, 24 Jun 2018 21:28:50 +0000 (24 23:28 +0200)
tree276f30c8122769144916445ec6b28d1fc106e103
parent50bcc8db3c17ba82c202080ca3d8d228afb909c5
libgimpwidgets: do not free the GtkAdjustment when finalizing...

... GimpMemsizeEntry.
A GtkAdjustment is a GInitiallyUnowned, which means it is created as a
floating reference. GtkSpinButton assumes its ownership by calling
g_object_ref_sink() in gtk_spin_button_new() implementation. Thus it
will take care of freeing it and when we try to unref it in finalize(),
the object already doesn't exist.

Alternatively we could keep another ref (by calling g_object_ref_sink()
ourselves) but since the spin button is a child of the entry, it will
live all the way until the entry is freed. There is no need to increment
the references. So instead, simplify the code, and don't try to free an
object we don't own anymore.

This fixes CRITICAL assertions:
> g_object_unref: assertion 'G_IS_OBJECT (object)' failed
libgimpwidgets/gimpmemsizeentry.c