[gimp] Bug 757739 - GIMP crashes closing undocked pointer dialog
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 757739 - GIMP crashes closing undocked pointer dialog
- Date: Sat, 7 Nov 2015 20:15:29 +0000 (UTC)
commit 10085b118a6e83e022573c7ecbd9b4d450f7d05c
Author: Michael Natterer <mitch gimp org>
Date: Sat Nov 7 21:14:40 2015 +0100
Bug 757739 - GIMP crashes closing undocked pointer dialog
Keep a reference to GimpCursorView's context around as long as the
widget is alive.
app/display/gimpcursorview.c | 28 ++++++++++++++++++++++------
1 files changed, 22 insertions(+), 6 deletions(-)
---
diff --git a/app/display/gimpcursorview.c b/app/display/gimpcursorview.c
index 4bd1aac..57636f2 100644
--- a/app/display/gimpcursorview.c
+++ b/app/display/gimpcursorview.c
@@ -86,6 +86,7 @@ struct _GimpCursorViewPriv
static void gimp_cursor_view_docked_iface_init (GimpDockedInterface *iface);
+static void gimp_cursor_view_dispose (GObject *object);
static void gimp_cursor_view_set_property (GObject *object,
guint property_id,
const GValue *value,
@@ -145,6 +146,7 @@ gimp_cursor_view_class_init (GimpCursorViewClass* klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+ object_class->dispose = gimp_cursor_view_dispose;
object_class->get_property = gimp_cursor_view_get_property;
object_class->set_property = gimp_cursor_view_set_property;
@@ -343,6 +345,17 @@ gimp_cursor_view_docked_iface_init (GimpDockedInterface *iface)
}
static void
+gimp_cursor_view_dispose (GObject *object)
+{
+ GimpCursorView *view = GIMP_CURSOR_VIEW (object);
+
+ if (view->priv->context)
+ gimp_docked_set_context (GIMP_DOCKED (view), NULL);
+
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
gimp_cursor_view_set_property (GObject *object,
guint property_id,
const GValue *value,
@@ -509,6 +522,9 @@ gimp_cursor_view_set_context (GimpDocked *docked,
GimpDisplay *display = NULL;
GimpImage *image = NULL;
+ if (context == view->priv->context)
+ return;
+
if (view->priv->context)
{
g_signal_handlers_disconnect_by_func (view->priv->context,
@@ -517,12 +533,16 @@ gimp_cursor_view_set_context (GimpDocked *docked,
g_signal_handlers_disconnect_by_func (view->priv->context,
gimp_cursor_view_image_changed,
view);
+
+ g_object_unref (view->priv->context);
}
view->priv->context = context;
if (view->priv->context)
{
+ g_object_ref (view->priv->context);
+
g_signal_connect_swapped (view->priv->context, "display-changed",
G_CALLBACK (gimp_cursor_view_diplay_changed),
view);
@@ -535,12 +555,8 @@ gimp_cursor_view_set_context (GimpDocked *docked,
image = gimp_context_get_image (context);
}
- gimp_cursor_view_diplay_changed (view,
- display,
- view->priv->context);
- gimp_cursor_view_image_changed (view,
- image,
- view->priv->context);
+ gimp_cursor_view_diplay_changed (view, display, view->priv->context);
+ gimp_cursor_view_image_changed (view, image, view->priv->context);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]