diff --git a/ChangeLog b/ChangeLog index 4edae693124fa451386b45de1e97727bd815ebc4..eca9c2429d325697765b92b91baa196477d546fb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2006-05-21 Michael Natterer + + * app/tools/tool_manager.c (tool_manager_image_clean_dirty): don't + try to reset the active tool by destroying and re-creating it + because this doesn't work while gimp->busy is TRUE. Call + tool_manager_control_active(HALT) instead, which is the right way + to do it anyway. Fixes bug #330083. + + Sprinkled some local variables all over the place to get rid of a + gazillion tool_manager->active_tool. + 2006-05-21 Bill Skaggs * app/tools/gimpaligntool.c: get rid of "dispose" method, use diff --git a/app/tools/tool_manager.c b/app/tools/tool_manager.c index 891edeba01e1ef55d158e39a094908a4e217ea43..fd10f35528f2ea7bc6c7adbdcd69531066792f86 100644 --- a/app/tools/tool_manager.c +++ b/app/tools/tool_manager.c @@ -149,14 +149,13 @@ tool_manager_select_tool (Gimp *gimp, if (tool_manager->active_tool) { - GimpDisplay *display = tool_manager->active_tool->display; + GimpTool *active_tool = tool_manager->active_tool; + GimpDisplay *display = active_tool->display; - if (! display && GIMP_IS_DRAW_TOOL (tool_manager->active_tool)) - display = GIMP_DRAW_TOOL (tool_manager->active_tool)->display; - - if (display) - tool_manager_control_active (gimp, HALT, display); + if (! display && GIMP_IS_DRAW_TOOL (active_tool)) + display = GIMP_DRAW_TOOL (active_tool)->display; + tool_manager_control_active (gimp, HALT, display); tool_manager_focus_display_active (gimp, NULL); g_object_unref (tool_manager->active_tool); @@ -198,13 +197,14 @@ tool_manager_pop_tool (Gimp *gimp) if (tool_manager->tool_stack) { - tool_manager_select_tool (gimp, - GIMP_TOOL (tool_manager->tool_stack->data)); - - g_object_unref (tool_manager->tool_stack->data); + GimpTool *tool = tool_manager->tool_stack->data; tool_manager->tool_stack = g_slist_remove (tool_manager->tool_stack, - tool_manager->active_tool); + tool); + + tool_manager_select_tool (gimp, tool); + + g_object_unref (tool); } } @@ -213,7 +213,6 @@ tool_manager_initialize_active (Gimp *gimp, GimpDisplay *display) { GimpToolManager *tool_manager; - GimpTool *tool; g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE); g_return_val_if_fail (GIMP_IS_DISPLAY (display), FALSE); @@ -222,7 +221,7 @@ tool_manager_initialize_active (Gimp *gimp, if (tool_manager->active_tool) { - tool = tool_manager->active_tool; + GimpTool *tool = tool_manager->active_tool; if (gimp_tool_initialize (tool, display)) { @@ -246,19 +245,21 @@ tool_manager_control_active (Gimp *gimp, tool_manager = tool_manager_get (gimp); - if (! tool_manager->active_tool) - return; - - if (display && (tool_manager->active_tool->display == display || - (GIMP_IS_DRAW_TOOL (tool_manager->active_tool) && - GIMP_DRAW_TOOL (tool_manager->active_tool)->display == display))) - { - gimp_tool_control (tool_manager->active_tool, action, display); - } - else if (action == HALT) + if (tool_manager->active_tool) { - if (gimp_tool_control_is_active (tool_manager->active_tool->control)) - gimp_tool_control_halt (tool_manager->active_tool->control); + GimpTool *tool = tool_manager->active_tool; + + if (display && (tool->display == display || + (GIMP_IS_DRAW_TOOL (tool) && + GIMP_DRAW_TOOL (tool)->display == display))) + { + gimp_tool_control (tool, action, display); + } + else if (action == HALT) + { + if (gimp_tool_control_is_active (tool->control)) + gimp_tool_control_halt (tool->control); + } } } @@ -546,19 +547,19 @@ tool_manager_image_clean_dirty (GimpImage *image, GimpDirtyMask dirty_mask, GimpToolManager *tool_manager) { - GimpTool *active_tool = tool_manager->active_tool; + GimpTool *tool = tool_manager->active_tool; - if (active_tool && - ! gimp_tool_control_get_preserve (active_tool->control) && - (gimp_tool_control_get_dirty_mask (active_tool->control) & dirty_mask)) + if (tool && + ! gimp_tool_control_get_preserve (tool->control) && + (gimp_tool_control_get_dirty_mask (tool->control) & dirty_mask)) { - GimpDisplay *display = active_tool->display; + GimpDisplay *display = tool->display; if (! display || display->image != image) - if (GIMP_IS_DRAW_TOOL (active_tool)) - display = GIMP_DRAW_TOOL (active_tool)->display; + if (GIMP_IS_DRAW_TOOL (tool)) + display = GIMP_DRAW_TOOL (tool)->display; if (display && display->image == image) - gimp_context_tool_changed (gimp_get_user_context (image->gimp)); + tool_manager_control_active (image->gimp, HALT, display); } }