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

List:       kde-commits
Subject:    koffice/libs/main
From:       Boudewijn Rempt <boud () valdyas ! org>
Date:       2010-08-11 13:58:10
Message-ID: 20100811140000.07509AC84E () svn ! kde ! org
[Download RAW message or body]

SVN commit 1162145 by rempt:

fix crash in FreOffice, where there might be no shell

 M  +8 -2      KoDocument.cpp  


--- trunk/koffice/libs/main/KoDocument.cpp #1162144:1162145
@@ -277,6 +277,8 @@
 namespace {
     KoMainWindow *currentShell(KoDocument *doc)
     {
+        if (!doc) return 0;
+
         QWidget *widget = qApp->activeWindow();
         KoMainWindow *shell = qobject_cast<KoMainWindow*>(widget);
         while (!shell && widget) {
@@ -284,8 +286,9 @@
             shell = qobject_cast<KoMainWindow*>(widget);
         }
 
-        if (!shell)
+        if (!shell && doc && doc->shells().size() > 0) {
             shell = doc->shells().first();
+        }
         return shell;
     }
     class DocumentProgressProxy : public KoProgressProxy {
@@ -307,8 +310,11 @@
         }
 
         void setValue(int value) {
-            currentShell(m_doc)->slotProgress(value);
+            KoMainWindow *mainWindow = currentShell(m_doc);
+            if (mainWindow) {
+                mainWindow->slotProgress(value);
         }
+        }
 
         void setRange(int /*minimum*/, int /*maximum*/) {
 
[prev in list] [next in list] [prev in thread] [next in thread] 

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