[gnome-documents] application: clean up window state in an idle



commit 1adfb607ef416d398e884356e05880bff761f16c
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Sat Feb 16 10:05:19 2013 -0500

    application: clean up window state in an idle
    
    So that we don't stomp on other cleanups (e.g. signal disconnections)
    that happen in a destroy handler too.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=693945

 src/application.js |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index b255afd..e691c05 100644
--- a/src/application.js
+++ b/src/application.js
@@ -450,9 +450,7 @@ const Application = new Lang.Class({
         return 0;
     },
 
-    _onWindowDestroy: function(window) {
-        this._mainWindow = null;
-
+    _clearState: function() {
         // clean up signals
         changeMonitor.disconnectAll();
         documentManager.disconnectAll();
@@ -470,6 +468,14 @@ const Application = new Lang.Class({
         this._stopMiners();
     },
 
+    _onWindowDestroy: function(window) {
+        this._mainWindow = null;
+
+        // clear our state in an idle, so other handlers connected
+        // to 'destroy' have the chance to perform their cleanups first
+        Mainloop.idle_add(Lang.bind(this, this._clearState));
+    },
+
     _onActivateResult: function(provider, urn, terms) {
         this._createWindow();
         modeController.setWindowMode(WindowMode.WindowMode.PREVIEW);


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