Issue #11958: Critical when opening an image.

I had added an assert in commit 98ebe96c1f specifically to catch other
cases where we may have run gimp_ui_manager_update() with inconsistent
user context, and I failed to catch the obvious CRITICAL (the damn Error
Console was catching it!).
Anyway we had this other obvious case when creating new displays in
gui_display_create() which would trigger the ui update with still
inconsistent context.

Now I'm in fact wondering why GimpContext is simply not returning the
active GimpDisplay's image and connecting to the "image" property of set
display so that it's always synchronized. But since we are so close to
GIMP 3, and I don't want to do too important restructuration of code
(why did we do this complicated update in 2 parts? Maybe there was a
good reason…) at this point, I'll just do the simple skip for now and
look more closely at GimpContext implementation after the release.
This commit is contained in:
Jehan 2024-08-27 13:41:19 +02:00
parent 82c607d4a8
commit 90e96d800b
1 changed files with 7 additions and 1 deletions

View File

@ -399,7 +399,13 @@ image_actions_update (GimpActionGroup *group,
{
GimpContext *context = gimp_get_user_context (gimp);
g_return_if_fail (context && image == gimp_context_get_image (context));
/* The discrepancy may happens when a new image just got opened
* and context was not fully updated yet. We just skip the actions
* update. There will soon be more events triggering it with
* consistent context.
*/
if (! context || image != gimp_context_get_image (context))
return;
}
#define SET_LABEL(action,label) \
gimp_action_group_set_action_label (group, action, (label))