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

List:       kde-commits
Subject:    KDE/kdegraphics/kviewshell/shell
From:       Wilfried Huss <Wilfried.Huss () gmx ! at>
Date:       2006-10-08 11:18:08
Message-ID: 1160306288.252544.3405.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 593576 by whuss:

Port of commit 588254:

Fix crash when embedding into kile or ark.

kparts are really a messy business.

 M  +22 -3     kviewpart.cpp  


--- trunk/KDE/kdegraphics/kviewshell/shell/kviewpart.cpp #593575:593576
@@ -936,8 +936,19 @@
     multiPage->setParentWidget(mainWidget);
 
     // Setup GUI that the multipage might wish to add
-    factory()->addClient(multiPage);
 
+    // For some KPart hosts (kile for example) don't build their GUI with
+    // KXMLGUIFactory, and factory() returns 0. In these cases we cannot
+    // add gui items of the plugins.
+    if (factory())
+    {
+      factory()->addClient(multiPage);
+    }
+    else
+    {
+      kError() << "factory() == NULL: cannot create plugin specific gui items." << endl;
+    }
+
     // Setup shared data
     multiPage->setupObservers(dataModel);
 
@@ -961,8 +972,16 @@
     // Initialize documentPageCache.
     pageCache->setRenderer(multiPage->getRenderer());
 
-    if (oldMultiPage != 0) {
-      factory()->removeClient(oldMultiPage);
+    if (oldMultiPage != 0)
+    {
+      if (factory())
+      {
+        factory()->removeClient(oldMultiPage);
+      }
+      else
+      {
+        kError() << "factory() == NULL: cannot remove plugin specific gui items." << endl;
+      }
       delete oldMultiPage;
     }
 
[prev in list] [next in list] [prev in thread] [next in thread] 

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