app: fix action_data_get_image() to return NULL more often

If "data" is a GimpItemTreeView or a GimpImageEditor, we REALLY want
only the image from these dialogs, even if NULL, and NOT some other
image from a display or context that randomly is around anyway. Fixes
the sensitivity states of lots of buttons in these dialogs.
This commit is contained in:
Michael Natterer 2023-05-26 15:25:15 +02:00
parent c9122fed2f
commit c4f71f553c
1 changed files with 10 additions and 2 deletions

View File

@ -365,9 +365,17 @@ action_data_get_image (gpointer data)
recursion = TRUE; recursion = TRUE;
if (GIMP_IS_ITEM_TREE_VIEW (data)) if (GIMP_IS_ITEM_TREE_VIEW (data))
result = gimp_item_tree_view_get_image ((GimpItemTreeView *) data); {
result = gimp_item_tree_view_get_image ((GimpItemTreeView *) data);
recursion = FALSE;
return result;
}
else if (GIMP_IS_IMAGE_EDITOR (data)) else if (GIMP_IS_IMAGE_EDITOR (data))
result = ((GimpImageEditor *) data)->image; {
result = ((GimpImageEditor *) data)->image;
recursion = FALSE;
return result;
}
if (! result) if (! result)
{ {