[gnome-documents/gnome-3-16] application: Thwart attempts to use the main window after its demise



commit 24e3ee1173583b89f49a43f20462f575274f436e
Author: Debarshi Ray <debarshir gnome org>
Date:   Fri Mar 13 20:00:59 2015 +0100

    application: Thwart attempts to use the main window after its demise
    
    Ideally we should cancel all pending operations when the main window
    has been destroyed, but that will require a more intrusive change. I am
    uncomfortable with making such a change at this point. So let's return
    1 and null as the scale factor and GdkWindow respectively, in the
    absence of a main window.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=746175

 src/application.js |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index e015f07..524c3fc 100644
--- a/src/application.js
+++ b/src/application.js
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 2014 Red Hat, Inc.
+ * Copyright (c) 2011, 2012, 2014, 2015 Red Hat, Inc.
  *
  * Gnome Documents is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by the
@@ -774,11 +774,19 @@ const Application = new Lang.Class({
     },
 
     getScaleFactor: function() {
-        return this._mainWindow.window.get_scale_factor();
+        let scaleFactor = 1;
+        if (this._mainWindow)
+            scaleFactor = this._mainWindow.window.get_scale_factor();
+
+        return scaleFactor;
     },
 
     getGdkWindow: function() {
-        return this._mainWindow.window.get_window();
+        let window = null;
+        if (this._mainWindow)
+            window = this._mainWindow.window.get_window();
+
+        return window;
     }
 });
 Utils.addJSSignalMethods(Application.prototype);


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