[dia] Bug 651949 - Don't crash on save in non-browse mode



commit cfc6810939d8fce9e17b306f4c72b58427b98a70
Author: Hans Breuer <hans breuer org>
Date:   Sun Jun 5 23:02:05 2011 +0200

    Bug 651949 - Don't crash on save in non-browse mode
    
    Not getting a filename looks like a contract violation in Gtk+ to me.
    Still Dia would be crashing, instead simply go back to the dialog.

 app/filedlg.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/app/filedlg.c b/app/filedlg.c
index 4c1a448..195b6e5 100644
--- a/app/filedlg.c
+++ b/app/filedlg.c
@@ -376,6 +376,12 @@ file_save_as_response_callback(GtkWidget *fs,
     dia = g_object_get_data (G_OBJECT(fs), "user_data");
 
     filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(fs));
+    if (!filename) {
+      /* Not getting a filename looks like a contract violation in Gtk+ to me.
+       * Still Dia would be crashing (bug #651949) - instead simply go back to the dialog. */
+      gtk_window_present (GTK_WINDOW (fs));
+      return;
+    }
 
     if (g_stat(filename, &stat_struct) == 0) {
       GtkWidget *dialog = NULL;



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