app: properly detach floating selection in dispose()

We crash when closing an image that has a floating selection and the
GEGL projection is being used. Detach the floating selection when
either the FS or the drawable it's attached to are disposed. This fix
only makes it crash later, but makes sense as separate commit.
This commit is contained in:
Michael Natterer 2011-09-23 19:55:24 +02:00
parent 5c8ded8960
commit e8f64664c9
2 changed files with 20 additions and 3 deletions

View File

@ -74,6 +74,7 @@ enum
static void gimp_drawable_pickable_iface_init (GimpPickableInterface *iface);
static void gimp_drawable_dispose (GObject *object);
static void gimp_drawable_finalize (GObject *object);
static gint64 gimp_drawable_get_memsize (GimpObject *object,
@ -218,6 +219,7 @@ gimp_drawable_class_init (GimpDrawableClass *klass)
gimp_marshal_VOID__VOID,
G_TYPE_NONE, 0);
object_class->dispose = gimp_drawable_dispose;
object_class->finalize = gimp_drawable_finalize;
gimp_object_class->get_memsize = gimp_drawable_get_memsize;
@ -275,12 +277,20 @@ gimp_drawable_pickable_iface_init (GimpPickableInterface *iface)
}
static void
gimp_drawable_finalize (GObject *object)
gimp_drawable_dispose (GObject *object)
{
GimpDrawable *drawable = GIMP_DRAWABLE (object);
if (drawable->private->fs_opacity_node)
gimp_drawable_sync_source_node (drawable, TRUE);
if (gimp_drawable_get_floating_sel (drawable))
gimp_drawable_detach_floating_sel (drawable);
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
gimp_drawable_finalize (GObject *object)
{
GimpDrawable *drawable = GIMP_DRAWABLE (object);
if (drawable->private->tiles)
{

View File

@ -402,6 +402,13 @@ gimp_layer_dispose (GObject *object)
gimp_layer_layer_mask_update,
layer);
if (gimp_layer_is_floating_sel (layer))
{
GimpDrawable *fs_drawable = gimp_layer_get_floating_sel_drawable (layer);
gimp_drawable_detach_floating_sel (fs_drawable);
}
G_OBJECT_CLASS (parent_class)->dispose (object);
}