app: fix a quite-random crash on exit with a race condition.

In some very hard-to-reproduce conditions, I experienced
tool_manager_selected_layers_changed() running on an invalid GimpToolManager
pointer (because tool_manager_exit() had already run) and therefore segfaulting
on quit. Let's make sure we disconnect the signal handler.
This commit is contained in:
Jehan 2023-10-15 11:38:45 +02:00
parent 68928ac5ab
commit 6d36e38018
1 changed files with 5 additions and 0 deletions

View File

@ -184,6 +184,11 @@ tool_manager_exit (Gimp *gimp)
tool_manager_image_changed,
tool_manager);
if (tool_manager->image)
g_signal_handlers_disconnect_by_func (tool_manager->image,
tool_manager_selected_layers_changed,
tool_manager);
gimp_container_remove_handler (gimp->images,
tool_manager->image_clean_handler_id);
gimp_container_remove_handler (gimp->images,