app: fix last fix for the region leak...

The fix was bogusly destroying a region that is still needed
for the last end_change() if the change count is > 1.
This commit is contained in:
Michael Natterer 2010-10-02 21:52:42 +02:00
parent cad95533dd
commit cfa17dc744
1 changed files with 23 additions and 21 deletions

View File

@ -469,34 +469,36 @@ gimp_canvas_item_end_change (GimpCanvasItem *item)
private->change_count--;
if (private->change_count == 0 &&
g_signal_has_handler_pending (item, item_signals[UPDATE], 0, FALSE))
if (private->change_count == 0)
{
GdkRegion *region = gimp_canvas_item_get_extents (item);
if (! region)
if (g_signal_has_handler_pending (item, item_signals[UPDATE], 0, FALSE))
{
region = private->change_region;
GdkRegion *region = gimp_canvas_item_get_extents (item);
if (! region)
{
region = private->change_region;
}
else if (private->change_region)
{
gdk_region_union (region, private->change_region);
gdk_region_destroy (private->change_region);
}
private->change_region = NULL;
if (region)
{
g_signal_emit (item, item_signals[UPDATE], 0,
region);
gdk_region_destroy (region);
}
}
else if (private->change_region)
{
gdk_region_union (region, private->change_region);
gdk_region_destroy (private->change_region);
private->change_region = NULL;
}
private->change_region = NULL;
if (region)
{
g_signal_emit (item, item_signals[UPDATE], 0,
region);
gdk_region_destroy (region);
}
}
else if (private->change_region)
{
gdk_region_destroy (private->change_region);
private->change_region = NULL;
}
}