app: make sure the private variable is a valid object if set.

Though this doesn't make a problem in normal use (AFAICS), we have crash
in a unit test in CI because the action_factory object was apparently
invalid when calling gimp_action_factory_delete_group().
This commit is contained in:
Jehan 2023-06-06 22:11:56 +02:00
parent 36fe8a979d
commit 0233531020
1 changed files with 4 additions and 2 deletions

View File

@ -104,6 +104,8 @@ gimp_menu_factory_finalize (GObject *object)
g_list_free (factory->p->registered_menus);
factory->p->registered_menus = NULL;
g_clear_weak_pointer (&factory->p->action_factory);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@ -118,8 +120,8 @@ gimp_menu_factory_new (Gimp *gimp,
factory = g_object_new (GIMP_TYPE_MENU_FACTORY, NULL);
factory->p->gimp = gimp;
factory->p->action_factory = action_factory;
factory->p->gimp = gimp;
g_set_weak_pointer (&factory->p->action_factory, action_factory);
return factory;
}