actions: Remove image from container after deletion
Resolves #9285 In images_delete_image_cmd_callback (), we dereference images which we want to delete. This works for images created via the GUI. However, images created via PDB scripts are not automatically connected to the display if created with no layers. If you try to delete them, they will be dereferenced but will still in the ImageView dockable. This can cause a crash if you try to access the container again, since it will point to an unreferenced variable. This patch removes the image from the container first before dereferencing it, to prevent the crash.
This commit is contained in:
parent
b5c79ebf94
commit
96a921f4d5
1 changed files with 4 additions and 1 deletions
|
|
@ -112,6 +112,9 @@ images_delete_image_cmd_callback (GimpAction *action,
|
||||||
if (image && gimp_container_have (container, GIMP_OBJECT (image)))
|
if (image && gimp_container_have (container, GIMP_OBJECT (image)))
|
||||||
{
|
{
|
||||||
if (gimp_image_get_display_count (image) == 0)
|
if (gimp_image_get_display_count (image) == 0)
|
||||||
g_object_unref (image);
|
{
|
||||||
|
gimp_container_remove (container, GIMP_OBJECT (image));
|
||||||
|
g_object_unref (image);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue