[gnome-shell] osdWindow: Check monitor validity before updating



commit ef04a9d1ed1d8ecad023fe7adb39baa521ec1551
Author: Florian Müllner <fmuellner gnome org>
Date:   Sat May 3 21:12:29 2014 +0200

    osdWindow: Check monitor validity before updating
    
    When a monitor is removed, the OsdWindow for that monitor may process
    the monitors-changed signal before OsdWindowManager does (which will
    remove the OSD). If that happens, we will currently try to access
    an invalid monitor; check for this to avoid a couple of warning.

 js/ui/osdWindow.js |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/osdWindow.js b/js/ui/osdWindow.js
index 6263070..bcdc391 100644
--- a/js/ui/osdWindow.js
+++ b/js/ui/osdWindow.js
@@ -192,6 +192,8 @@ const OsdWindow = new Lang.Class({
     _monitorsChanged: function() {
         /* assume 110x110 on a 640x480 display and scale from there */
         let monitor = Main.layoutManager.monitors[this._monitorIndex];
+        if (!monitor)
+            return; // we are about to be removed
 
         let scalew = monitor.width / 640.0;
         let scaleh = monitor.height / 480.0;


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