[glom/glom-1-24] Avoid a crash at shutdown.



commit cead47965183a819e237c345e2136c547be50355
Author: Murray Cumming <murrayc murrayc com>
Date:   Wed Sep 11 10:24:45 2013 +0200

    Avoid a crash at shutdown.
    
        * glom/bakery/appwindow_withdoc.cc: on_menu_file_close():
        Close the document after hiding the UI, instead of the other way
        around because, with Gio::Application, hiding the window can cause
        it to be deleted, making any further use of it impossible.

 ChangeLog                        |    9 +++++++++
 glom/bakery/appwindow_withdoc.cc |    8 ++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 9b94067..6047a28 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2013-08-19  Murray Cumming  <murrayc murrayc com>
+
+       Avoid a crash at shutdown.
+
+       * glom/bakery/appwindow_withdoc.cc: on_menu_file_close():
+       Close the document after hiding the UI, instead of the other way
+       around because, with Gio::Application, hiding the window can cause
+       it to be deleted, making any further use of it impossible.
+
 2013-07-18  Murray Cumming  <murrayc murrayc com>
 
        Initial dialog: Fix crash with latest libxml.
diff --git a/glom/bakery/appwindow_withdoc.cc b/glom/bakery/appwindow_withdoc.cc
index 1cb82a6..21136cd 100644
--- a/glom/bakery/appwindow_withdoc.cc
+++ b/glom/bakery/appwindow_withdoc.cc
@@ -58,10 +58,14 @@ void AppWindow_WithDoc::on_menu_file_close()
     offer_to_save_changes(); //If a File|Exit is in progress, this could cancel it.
   }
 
+  on_document_close();
+
   if(!get_operation_cancelled())
+  {
+    //Note that this can result in this appwindow being deleted,
+    //so we do it last.
     ui_hide();
-
-  on_document_close();
+  }
 }
 
 bool AppWindow_WithDoc::open_document_from_data(const guchar* data, std::size_t length)


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