[gimp/gimp-2-10] app: avoid double-initialization of operation tools when changing layers
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] app: avoid double-initialization of operation tools when changing layers
- Date: Sat, 29 Sep 2018 18:32:15 +0000 (UTC)
commit fc77bf31bc157ba1359eb8e73c81bfad9268d01c
Author: Ell <ell_se yahoo com>
Date: Sat Sep 29 14:24:28 2018 -0400
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 a21667821c9f6a2c5604699f4abc6e7d3579f3b1)
app/display/gimpdisplayshell-tool-events.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-tool-events.c b/app/display/gimpdisplayshell-tool-events.c
index 01aa85a398..743b89c9a9 100644
--- a/app/display/gimpdisplayshell-tool-events.c
+++ b/app/display/gimpdisplayshell-tool-events.c
@@ -1879,8 +1879,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)
{
@@ -1931,6 +1929,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
{
@@ -1941,7 +1944,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;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]