[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kwin
Subject:    Fix for kwin crash with multiple monitors
From:       "Guillaume Pothier" <gpothier () gmail ! com>
Date:       2008-10-16 12:42:39
Message-ID: 8caa8ded0810160542m31753a26h65308b02fb90b26d () mail ! gmail ! com
[Download RAW message or body]

Hi,
I'm currently hacking on the multimonitor support (there is a long
thread in the plasma mailing list for reference). With two monitors
plugged in, kwin frequently crashes in Workspace::clientArea(
clientAreaOption, int, int ). The problem is the screenarea/workarea
arrays are sometimes smaller than expected. The attached patch works
around the crash by simply testing the size of the arrays. I guess
it's not the definitive solution but at least it avoids the crash. Ok
to commit?
g

["kwin-crashfix.diff" (text/plain)]

Index: kdebase/workspace/kwin/geometry.cpp
===================================================================
--- kdebase/workspace/kwin/geometry.cpp	(revision 871913)
+++ kdebase/workspace/kwin/geometry.cpp	(working copy)
@@ -230,13 +230,30 @@
         desktop = currentDesktop();
     if( screen == -1 )
         screen = activeScreen();
+    
     QDesktopWidget *desktopwidget = KApplication::desktop();
-    QRect sarea = !screenarea.isEmpty() // may be empty during KWin initialization
-        ? screenarea[ desktop ][ screen ]
-        : desktopwidget->screenGeometry( screen );
-    QRect warea = workarea[ desktop ].isNull()
-        ? QApplication::desktop()->geometry()
-        : workarea[ desktop ];
+    QRect sarea;
+    if (desktop < screenarea.size() && screen < screenarea[ desktop ].size())
+        {
+        sarea = screenarea[ desktop ][ screen ];
+        }
+    else
+        {
+        kDebug() << "No such desktop/screen" << desktop << screen;
+        sarea = desktopwidget->screenGeometry( screen );
+        }
+
+    QRect warea;
+    if (desktop < workarea.size())
+        {
+        warea = workarea[ desktop ];
+        }
+    else
+        {
+        kDebug() << "No such desktop" << desktop;
+        warea = QApplication::desktop()->geometry();
+        }
+
     switch (opt)
         {
         case MaximizeArea:


_______________________________________________
kwin mailing list
kwin@kde.org
https://mail.kde.org/mailman/listinfo/kwin


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic