Commit a2166782 authored by Ell's avatar Ell

app: avoid double-initialization of operation tools when changing layers

When re-activating an operation tool by clicking on a different
drawable while the tool is active, we re-call the corresponding
procedure to re-activate the tool, which implictly initializes it.
Avoid initializaing it explicitly in addition to that, since this
leads to the creation of a new config object by the filter tool,
while the GUI still refers to the old, now-dead, config object,
causing CRITICALs or segfaults when changing any parameter.
parent d12dd3fb
......@@ -1842,8 +1842,6 @@ gimp_display_shell_initialize_tool (GimpDisplayShell *shell,
(! gimp_image_is_empty (image) ||
gimp_tool_control_get_handle_empty_image (active_tool->control)))
{
initialized = TRUE;
/* initialize the current tool if it has no drawable */
if (! active_tool->drawable)
{
......@@ -1894,6 +1892,11 @@ gimp_display_shell_initialize_tool (GimpDisplayShell *shell,
gimp_filter_history_add (gimp, procedure);
gimp_ui_manager_activate_action (manager, "filters",
"filters-reshow");
/* the procedure already initialized the tool; don't
* reinitialize it below, since this can lead to errors.
*/
initialized = TRUE;
}
else
{
......@@ -1904,7 +1907,12 @@ gimp_display_shell_initialize_tool (GimpDisplayShell *shell,
/* make sure the newly created tool has the right state */
gimp_display_shell_update_focus (shell, TRUE, image_coords, state);
initialized = tool_manager_initialize_active (gimp, display);
if (! initialized)
initialized = tool_manager_initialize_active (gimp, display);
}
else
{
initialized = TRUE;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment