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



commit affbfd097abaf70f3866727454712b4aa7274abf
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 efd0c07..75b06cf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2013-09-11  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.
+
 1.22.2 (stable):
 
 2012-11-10  Murray Cumming  <murrayc murrayc com>
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]