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.
(cherry picked from commit a21667821c)
This commit is contained in:
@ -1879,8 +1879,6 @@ gimp_display_shell_initialize_tool (GimpDisplayShell *shell,
|
|||||||
(! gimp_image_is_empty (image) ||
|
(! gimp_image_is_empty (image) ||
|
||||||
gimp_tool_control_get_handle_empty_image (active_tool->control)))
|
gimp_tool_control_get_handle_empty_image (active_tool->control)))
|
||||||
{
|
{
|
||||||
initialized = TRUE;
|
|
||||||
|
|
||||||
/* initialize the current tool if it has no drawable */
|
/* initialize the current tool if it has no drawable */
|
||||||
if (! active_tool->drawable)
|
if (! active_tool->drawable)
|
||||||
{
|
{
|
||||||
@ -1931,6 +1929,11 @@ gimp_display_shell_initialize_tool (GimpDisplayShell *shell,
|
|||||||
gimp_filter_history_add (gimp, procedure);
|
gimp_filter_history_add (gimp, procedure);
|
||||||
gimp_ui_manager_activate_action (manager, "filters",
|
gimp_ui_manager_activate_action (manager, "filters",
|
||||||
"filters-reshow");
|
"filters-reshow");
|
||||||
|
|
||||||
|
/* the procedure already initialized the tool; don't
|
||||||
|
* reinitialize it below, since this can lead to errors.
|
||||||
|
*/
|
||||||
|
initialized = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1941,7 +1944,12 @@ gimp_display_shell_initialize_tool (GimpDisplayShell *shell,
|
|||||||
/* make sure the newly created tool has the right state */
|
/* make sure the newly created tool has the right state */
|
||||||
gimp_display_shell_update_focus (shell, TRUE, image_coords, 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user