[gimp] app: in GimpCanvasBufferPreview, take strong ref on buffer
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: in GimpCanvasBufferPreview, take strong ref on buffer
- Date: Mon, 3 Feb 2020 19:24:38 +0000 (UTC)
commit ea864e2d5c095a04317f0b70b240111dd240d044
Author: Ell <ell_se yahoo com>
Date: Mon Feb 3 20:01:03 2020 +0200
app: in GimpCanvasBufferPreview, take strong ref on buffer
In GimpCanvasBufferPreview, take a strong reference on the preview
buffer, fixing a segfault in the foreground-select tool when
switching engines while the grayscale preview is active.
app/display/gimpcanvasbufferpreview.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
---
diff --git a/app/display/gimpcanvasbufferpreview.c b/app/display/gimpcanvasbufferpreview.c
index 26b1171787..858bab634b 100644
--- a/app/display/gimpcanvasbufferpreview.c
+++ b/app/display/gimpcanvasbufferpreview.c
@@ -58,6 +58,7 @@ struct _GimpCanvasBufferPreviewPrivate
/* local function prototypes */
+static void gimp_canvas_buffer_preview_dispose (GObject *object);
static void gimp_canvas_buffer_preview_set_property (GObject *object,
guint property_id,
const GValue *value,
@@ -86,6 +87,7 @@ gimp_canvas_buffer_preview_class_init (GimpCanvasBufferPreviewClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpCanvasItemClass *item_class = GIMP_CANVAS_ITEM_CLASS (klass);
+ object_class->dispose = gimp_canvas_buffer_preview_dispose;
object_class->set_property = gimp_canvas_buffer_preview_set_property;
object_class->get_property = gimp_canvas_buffer_preview_get_property;
@@ -104,6 +106,16 @@ gimp_canvas_buffer_preview_init (GimpCanvasBufferPreview *transform_preview)
{
}
+static void
+gimp_canvas_buffer_preview_dispose (GObject *object)
+{
+ GimpCanvasBufferPreviewPrivate *private = GET_PRIVATE (object);
+
+ g_clear_object (&private->buffer);
+
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
static void
gimp_canvas_buffer_preview_set_property (GObject *object,
guint property_id,
@@ -115,7 +127,7 @@ gimp_canvas_buffer_preview_set_property (GObject *object,
switch (property_id)
{
case PROP_BUFFER:
- private->buffer = g_value_get_object (value); /* don't ref */
+ g_set_object (&private->buffer, g_value_get_object (value));
break;
default:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]