[gimp] Bug 794378 - GIMP crashed while I was moving the image window
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 794378 - GIMP crashed while I was moving the image window
- Date: Tue, 20 Mar 2018 18:03:16 +0000 (UTC)
commit 9a365eaf8bc94a5770ef82fa92a7fdab663d112e
Author: Michael Natterer <mitch gimp org>
Date: Tue Mar 20 19:01:17 2018 +0100
Bug 794378 - GIMP crashed while I was moving the image window
Use a weak pointer in GimpToolGui to not keep a dangling
private->viewable around.
app/display/gimptoolgui.c | 21 ++++++++++++++++++---
1 files changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/app/display/gimptoolgui.c b/app/display/gimptoolgui.c
index 597a9b9..7d90a53 100644
--- a/app/display/gimptoolgui.c
+++ b/app/display/gimptoolgui.c
@@ -160,6 +160,9 @@ gimp_tool_gui_dispose (GObject *object)
if (private->shell)
gimp_tool_gui_set_shell (GIMP_TOOL_GUI (object), NULL);
+ if (private->viewable)
+ gimp_tool_gui_set_viewable (GIMP_TOOL_GUI (object), NULL);
+
g_clear_object (&private->vbox);
if (private->dialog)
@@ -419,15 +422,23 @@ gimp_tool_gui_set_viewable (GimpToolGui *gui,
GimpToolGuiPrivate *private;
g_return_if_fail (GIMP_IS_TOOL_GUI (gui));
- g_return_if_fail (GIMP_IS_VIEWABLE (viewable));
+ g_return_if_fail (viewable == NULL || GIMP_IS_VIEWABLE (viewable));
private = GET_PRIVATE (gui);
if (private->viewable == viewable)
return;
+ if (private->viewable)
+ g_object_remove_weak_pointer (G_OBJECT (private->viewable),
+ (gpointer) &private->viewable);
+
private->viewable = viewable;
+ if (private->viewable)
+ g_object_add_weak_pointer (G_OBJECT (private->viewable),
+ (gpointer) &private->viewable);
+
gimp_tool_gui_update_viewable (gui);
}
@@ -883,9 +894,13 @@ gimp_tool_gui_update_viewable (GimpToolGui *gui)
if (! private->overlay)
{
+ GimpContext *context = NULL;
+
+ if (private->tool_info)
+ context = GIMP_CONTEXT (private->tool_info->tool_options);
+
gimp_viewable_dialog_set_viewable (GIMP_VIEWABLE_DIALOG (private->dialog),
- private->viewable,
- GIMP_CONTEXT (private->tool_info->tool_options));
+ private->viewable, context);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]