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



commit 5c9b4f846ec73cab2d456154d3020218c60e2411
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.
    
    (cherry picked from commit cfc6810939d8fce9e17b306f4c72b58427b98a70)

 app/filedlg.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/app/filedlg.c b/app/filedlg.c
index 3c7ed24..db3f103 100644
--- a/app/filedlg.c
+++ b/app/filedlg.c
@@ -360,6 +360,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]