Issue #3134 - Deleting last layer of group not updating image

In gimp_group_layer_get_size(), make sure to always set *width and
*height, even when the group is empty, so that when the function is
called through gimp_projectable_get_size() by the group's
projection, the correct size is reported.  This makes sure we
update the correct area when the group becomes empty.
This commit is contained in:
Ell
2019-03-20 17:45:03 -04:00
parent 8e77347cac
commit a712308f20

View File

@ -456,6 +456,7 @@ gimp_group_layer_get_size (GimpViewable *viewable,
gint *height) gint *height)
{ {
GimpGroupLayerPrivate *private = GET_PRIVATE (viewable); GimpGroupLayerPrivate *private = GET_PRIVATE (viewable);
gboolean result;
if (private->reallocate_width != 0 && if (private->reallocate_width != 0 &&
private->reallocate_height != 0) private->reallocate_height != 0)
@ -466,13 +467,18 @@ gimp_group_layer_get_size (GimpViewable *viewable,
return TRUE; return TRUE;
} }
/* return the size only if there are children... */ result = GIMP_VIEWABLE_CLASS (parent_class)->get_size (viewable,
if (gimp_item_stack_get_item_iter (GIMP_ITEM_STACK (private->children)))
return GIMP_VIEWABLE_CLASS (parent_class)->get_size (viewable,
width, height); width, height);
/* ...otherwise return "no content" */ /* if the group is empty, return "no content" through
return FALSE; * gimp_viewable_get_size(), but make sure to set *width and *height anyway,
* so that the correct size is reported to the projection through
* gimp_projectable_get_size(). see issue #3134.
*/
if (gimp_container_is_empty (private->children))
result = FALSE;
return result;
} }
static GimpContainer * static GimpContainer *