Commit a7e706f7 authored by Michael Natterer's avatar Michael Natterer 😴

app: must set GimpDrawTool's widget to NULL when a tools is halted

We were leaking all tool widgets set with gimp_draw_tool_set_widget(),
and those having signal connections to e.g. the display shell were
doing things when they were supposed to be gone. Fixes make check.
parent 4ea88689
......@@ -686,17 +686,14 @@ gimp_blend_tool_halt (GimpBlendTool *blend_tool)
if (tool->display)
gimp_tool_pop_status (tool, tool->display);
tool->display = NULL;
tool->drawable = NULL;
if (gimp_draw_tool_is_active (GIMP_DRAW_TOOL (blend_tool)))
gimp_draw_tool_stop (GIMP_DRAW_TOOL (blend_tool));
if (blend_tool->line)
{
g_object_unref (blend_tool->line);
blend_tool->line = NULL;
}
gimp_draw_tool_set_widget (GIMP_DRAW_TOOL (tool), NULL);
g_clear_object (&blend_tool->line);
tool->display = NULL;
tool->drawable = NULL;
}
static void
......
......@@ -493,6 +493,7 @@ gimp_crop_tool_halt (GimpCropTool *crop_tool)
if (gimp_draw_tool_is_active (GIMP_DRAW_TOOL (tool)))
gimp_draw_tool_stop (GIMP_DRAW_TOOL (tool));
gimp_draw_tool_set_widget (GIMP_DRAW_TOOL (tool), NULL);
g_clear_object (&crop_tool->rectangle);
tool->display = NULL;
......
......@@ -244,6 +244,7 @@ gimp_free_select_tool_halt (GimpFreeSelectTool *fst)
{
GimpFreeSelectToolPrivate *private = fst->private;
gimp_draw_tool_set_widget (GIMP_DRAW_TOOL (fst), NULL);
g_clear_object (&private->polygon);
}
......
......@@ -420,13 +420,15 @@ gimp_measure_tool_halt (GimpMeasureTool *measure)
{
GimpTool *tool = GIMP_TOOL (measure);
if (gimp_draw_tool_is_active (GIMP_DRAW_TOOL (measure)))
gimp_draw_tool_stop (GIMP_DRAW_TOOL (measure));
if (tool->display)
gimp_tool_pop_status (tool, tool->display);
if (gimp_draw_tool_is_active (GIMP_DRAW_TOOL (measure)))
gimp_draw_tool_stop (GIMP_DRAW_TOOL (measure));
gimp_draw_tool_set_widget (GIMP_DRAW_TOOL (tool), NULL);
g_clear_object (&measure->compass);
g_clear_object (&measure->gui);
tool->display = NULL;
......
......@@ -853,6 +853,7 @@ gimp_rectangle_select_tool_halt (GimpRectangleSelectTool *rect_tool)
if (gimp_draw_tool_is_active (GIMP_DRAW_TOOL (tool)))
gimp_draw_tool_stop (GIMP_DRAW_TOOL (tool));
gimp_draw_tool_set_widget (GIMP_DRAW_TOOL (tool), NULL);
g_clear_object (&priv->rectangle);
tool->display = NULL;
......
......@@ -1078,6 +1078,7 @@ gimp_transform_tool_halt (GimpTransformTool *tr_tool)
if (gimp_draw_tool_is_active (GIMP_DRAW_TOOL (tr_tool)))
gimp_draw_tool_stop (GIMP_DRAW_TOOL (tr_tool));
gimp_draw_tool_set_widget (GIMP_DRAW_TOOL (tr_tool), NULL);
g_clear_object (&tr_tool->widget);
if (tr_tool->gui)
......
......@@ -430,13 +430,15 @@ gimp_vector_tool_halt (GimpVectorTool *vector_tool)
{
GimpTool *tool = GIMP_TOOL (vector_tool);
if (gimp_draw_tool_is_active (GIMP_DRAW_TOOL (tool)))
gimp_draw_tool_stop (GIMP_DRAW_TOOL (tool));
if (tool->display)
gimp_tool_pop_status (tool, tool->display);
gimp_vector_tool_set_vectors (vector_tool, NULL);
if (gimp_draw_tool_is_active (GIMP_DRAW_TOOL (tool)))
gimp_draw_tool_stop (GIMP_DRAW_TOOL (tool));
gimp_draw_tool_set_widget (GIMP_DRAW_TOOL (tool), NULL);
g_clear_object (&vector_tool->path);
tool->display = NULL;
......
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