[gimp/gimp-2-8] app: file_open_from_command_line(): don't access a dangling display pointer
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-8] app: file_open_from_command_line(): don't access a dangling display pointer
- Date: Thu, 4 Jul 2013 19:11:56 +0000 (UTC)
commit dea99e516b6c796e423da579ea387997a13d4e13
Author: Massimo Valentini <mvalentini src gnome org>
Date: Thu Jul 4 21:05:25 2013 +0200
app: file_open_from_command_line(): don't access a dangling display pointer
Happens if GIMP is quit while the image is being loaded.
(cherry picked from commit 6c62eb2238d2167ebe20ee02ad32ef733db475b1)
app/file/file-open.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/app/file/file-open.c b/app/file/file-open.c
index 8abb19e..fdf73f3 100644
--- a/app/file/file-open.c
+++ b/app/file/file-open.c
@@ -562,6 +562,8 @@ file_open_from_command_line (Gimp *gimp,
GimpObject *display = gimp_get_empty_display (gimp);
GimpPDBStatusType status;
+ g_object_add_weak_pointer (G_OBJECT (display), (gpointer) &display);
+
image = file_open_with_display (gimp,
gimp_get_user_context (gimp),
GIMP_PROGRESS (display),
@@ -575,7 +577,7 @@ file_open_from_command_line (Gimp *gimp,
g_object_set_data_full (G_OBJECT (gimp), GIMP_FILE_OPEN_LAST_URI_KEY,
uri, (GDestroyNotify) g_free);
}
- else if (status != GIMP_PDB_CANCEL)
+ else if (status != GIMP_PDB_CANCEL && display)
{
gchar *filename = file_utils_uri_display_name (uri);
@@ -587,6 +589,9 @@ file_open_from_command_line (Gimp *gimp,
g_free (filename);
g_free (uri);
}
+
+ if (display)
+ g_object_remove_weak_pointer (G_OBJECT (display), (gpointer) &display);
}
else
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]