mirror of https://github.com/GNOME/gimp.git
app: fix GEGL buffer leaks.
Since commit 10b96b1025
, we had buffer leaks as soon as we ran filters.
gimp_drawable_get_buffer_with_effects() was either creating a new buffer (when a
drawable had filters) or not. And calling code couldn't know which is which.
Code needs to be consistent. Either we return a new reference to take ownership
to, or not. So let's change to add a new reference to the drawable' buffers so
that it always returns a new reference to free.
This commit is contained in:
parent
6e1cc909ce
commit
f46c536ebb
|
@ -83,7 +83,8 @@ sub_preview_data_new (const Babl *format,
|
|||
SubPreviewData *data = g_slice_new (SubPreviewData);
|
||||
|
||||
data->format = format;
|
||||
data->buffer = g_object_ref (buffer);
|
||||
/* We take ownership if the buffer reference. */
|
||||
data->buffer = buffer;
|
||||
data->rect = *rect;
|
||||
data->scale = scale;
|
||||
|
||||
|
@ -231,6 +232,7 @@ gimp_drawable_get_sub_preview (GimpDrawable *drawable,
|
|||
gimp_temp_buf_get_format (preview),
|
||||
gimp_temp_buf_get_data (preview),
|
||||
GEGL_AUTO_ROWSTRIDE, GEGL_ABYSS_CLAMP);
|
||||
g_object_unref (buffer);
|
||||
|
||||
return preview;
|
||||
}
|
||||
|
@ -328,6 +330,8 @@ gimp_drawable_get_sub_pixbuf (GimpDrawable *drawable,
|
|||
GEGL_ABYSS_CLAMP);
|
||||
}
|
||||
|
||||
g_object_unref (buffer);
|
||||
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
|
|
|
@ -1537,17 +1537,17 @@ gimp_drawable_get_buffer_with_effects (GimpDrawable *drawable)
|
|||
}
|
||||
else
|
||||
{
|
||||
return buffer;
|
||||
return g_object_ref (buffer);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return GIMP_DRAWABLE_GET_CLASS (drawable)->get_buffer (drawable);
|
||||
return g_object_ref (GIMP_DRAWABLE_GET_CLASS (drawable)->get_buffer (drawable));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return drawable->private->paint_buffer;
|
||||
return g_object_ref (drawable->private->paint_buffer);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -200,7 +200,7 @@ gimp_pickable_get_buffer_with_effects (GimpPickable *pickable)
|
|||
if (pickable_iface->get_buffer_with_effects)
|
||||
return pickable_iface->get_buffer_with_effects (pickable);
|
||||
else if (pickable_iface->get_buffer)
|
||||
return pickable_iface->get_buffer (pickable);
|
||||
return g_object_ref (pickable_iface->get_buffer (pickable));
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue