[gthumb] crash in load_file_attributes_ready_cb in response to UNIQUE_OPEN due to browser == NULL



commit 1b980e36e0dd15d85592cc0054d18c661868f329
Author: dynamotwain <dynamotwain aim com>
Date:   Mon Sep 13 10:04:02 2010 +0200

    crash in load_file_attributes_ready_cb in response to UNIQUE_OPEN due to browser == NULL
    
    When multiple GThumb windows are opened in a process (either via File|New
    Window or `gthumb -n`), and one attempts to open an image via an external
    application (through a method not involving the '-n' option, such as through
    gthumb.desktop or directly from the commandline), GThumb crashes due to the
    'browser' pointer in load_file_attributes_ready_cb is NULL.

 gthumb/main.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/gthumb/main.c b/gthumb/main.c
index 03f1377..989ac39 100644
--- a/gthumb/main.c
+++ b/gthumb/main.c
@@ -192,17 +192,19 @@ unique_app_message_received_cb (UniqueApp         *unique_app,
 	UniqueResponse  res;
 	char           *uri;
 	GFile          *location = NULL;
-	GtkWidget      *window;
+	GtkWidget      *window = NULL;
 
 	res = UNIQUE_RESPONSE_OK;
 
 	switch (command) {
 	case UNIQUE_OPEN:
 	case UNIQUE_NEW:
-		if (command == UNIQUE_NEW)
-			window = gth_browser_new (NULL);
-		else
+		if (command == UNIQUE_OPEN)
 			window = gth_window_get_current_window ();
+
+		if (window == NULL)
+			window = gth_browser_new (NULL);
+
 		show_window (GTK_WINDOW (window),
 			     unique_message_data_get_startup_id (message),
 			     unique_message_data_get_screen (message));



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]