app: ref/unref layer->fs.drawable in gimp_layer_set_floating_sel_drawable()

It always felt wrong not to ref it, but now it started crashing. Dunno
what exactly has changed, but for example the "Weave" script was
triggering it.
This commit is contained in:
Michael Natterer 2014-05-20 23:39:53 +02:00
parent 40030e084b
commit d1b8a715c2
1 changed files with 8 additions and 7 deletions

View File

@ -452,6 +452,8 @@ gimp_layer_dispose (GObject *object)
*/
if (gimp_drawable_get_floating_sel (fs_drawable) == layer)
gimp_drawable_detach_floating_sel (fs_drawable);
gimp_layer_set_floating_sel_drawable (layer, NULL);
}
G_OBJECT_CLASS (parent_class)->dispose (object);
@ -468,13 +470,6 @@ gimp_layer_finalize (GObject *object)
layer->mask = NULL;
}
if (layer->fs.segs)
{
g_free (layer->fs.segs);
layer->fs.segs = NULL;
layer->fs.num_segs = 0;
}
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@ -1992,8 +1987,14 @@ gimp_layer_set_floating_sel_drawable (GimpLayer *layer,
layer->fs.num_segs = 0;
}
if (layer->fs.drawable)
g_object_unref (layer->fs.drawable);
layer->fs.drawable = drawable;
if (layer->fs.drawable)
g_object_ref (layer->fs.drawable);
g_object_notify (G_OBJECT (layer), "floating-selection");
}
}