84 lines
2.8 KiB
Diff
84 lines
2.8 KiB
Diff
From dcb8cc2ce47a59d6e8c2272755f0b8c00e391fe0 Mon Sep 17 00:00:00 2001
|
|
From: Nils Philippsen <nils@redhat.com>
|
|
Date: Fri, 10 Jun 2011 21:36:23 +0200
|
|
Subject: [PATCH] patch: shell-dnd-quit-crash
|
|
|
|
Squashed commit of the following:
|
|
|
|
commit 3028f226d577cdf4fc2b01b53beeb1edd8b69a8b
|
|
Author: Nils Philippsen <nils@redhat.com>
|
|
Date: Fri Jun 10 18:06:02 2011 +0200
|
|
|
|
app: guard against crash due to quitting while DND is processed
|
|
|
|
In gimp_display_shell_drop_uri_list(), shell->display is dereferenced in
|
|
some places without checking that it's still there. It can be set to
|
|
NULL if the user quits the application while a drag and drop action is
|
|
being processed and the main loop is iterated during execution of this
|
|
function. (Bug #652280)
|
|
(cherry picked from commit b1a2c736bf7e6c75ca1af4b4c3330172dddb269e)
|
|
|
|
Conflicts:
|
|
|
|
app/display/gimpdisplayshell-dnd.c
|
|
---
|
|
app/display/gimpdisplayshell-dnd.c | 25 ++++++++++++++++++++++---
|
|
1 files changed, 22 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/app/display/gimpdisplayshell-dnd.c b/app/display/gimpdisplayshell-dnd.c
|
|
index 8d210a8..1e67fda 100644
|
|
--- a/app/display/gimpdisplayshell-dnd.c
|
|
+++ b/app/display/gimpdisplayshell-dnd.c
|
|
@@ -458,11 +458,21 @@ gimp_display_shell_drop_uri_list (GtkWidget *widget,
|
|
gpointer data)
|
|
{
|
|
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (data);
|
|
- GimpImage *image = shell->display->image;
|
|
- GimpContext *context = gimp_get_user_context (shell->display->gimp);
|
|
+ GimpImage *image;
|
|
+ GimpContext *context;
|
|
GList *list;
|
|
gboolean open_as_layers;
|
|
|
|
+ /* If the app is already being torn down, shell->display might be NULL here.
|
|
+ * Play it safe. */
|
|
+ if (! shell->display)
|
|
+ {
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ image = shell->display->image;
|
|
+ context = gimp_get_user_context (shell->display->gimp);
|
|
+
|
|
GIMP_LOG (DND, NULL);
|
|
|
|
open_as_layers = (shell->display->image != NULL);
|
|
@@ -474,6 +484,12 @@ gimp_display_shell_drop_uri_list (GtkWidget *widget,
|
|
GError *error = NULL;
|
|
gboolean warn = FALSE;
|
|
|
|
+ if (! shell->display)
|
|
+ {
|
|
+ /* It seems as if GIMP is being torn down for quitting. Bail out. */
|
|
+ return;
|
|
+ }
|
|
+
|
|
if (open_as_layers)
|
|
{
|
|
GList *new_layers;
|
|
@@ -528,7 +544,10 @@ gimp_display_shell_drop_uri_list (GtkWidget *widget,
|
|
warn = TRUE;
|
|
}
|
|
|
|
- if (warn)
|
|
+ /* Something above might have run a few rounds of the main loop. Check
|
|
+ * that shell->display is still there, otherwise ignore this as the app
|
|
+ * is being torn down for quitting. */
|
|
+ if (warn && shell->display)
|
|
{
|
|
gchar *filename = file_utils_uri_display_name (uri);
|
|
|
|
--
|
|
1.7.5.2
|
|
|