[Patch] Gideon

Otto Bruggeman bruggie at home.nl
Sun Sep 30 01:14:30 UTC 2001


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sun, 30 Sep 2001, Bernd Gehrmann wrote:
> If you display the message box in PartLoader::loadService(), why do you
> display it again in the calling routines?
>
> Bernd.

Uhm... to be honest i did not look into the code very much but when i
fixed the error in partLoader i kept seeing more null pointer crashes so i
fixed them all similarly... might have overdone it overdone it with
the messageboxes because i am not familiar with the code... a simple if
(!part) return; would be enough then i guess. Revised version attached.

Otto
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Made with pgp4pine 1.75-6

iD8DBQE7tnIADc93sltYd+ERAu/vAJ9LlMOhRzkEPBsQcqi/ay1mR/gQygCcCzr4
j3IuQQ4e2pCtJo1//+jE4DY=
=k3le
-----END PGP SIGNATURE-----

-------------- next part --------------
Index: src/core.cpp
===================================================================
RCS file: /home/kde/kdevelop/src/core.cpp,v
retrieving revision 1.43
diff -u -3 -p -r1.43 core.cpp
--- src/core.cpp	2001/09/26 19:53:10	1.43
+++ src/core.cpp	2001/09/30 01:11:35
@@ -225,6 +225,8 @@ void Core::initGlobalParts()
         return;
     service = *makeFrontendOffers.begin();
     part = PartLoader::loadService(service, "KDevMakeFrontend", api, this);
+    if (!part)
+        return;
     initPart(api->makeFrontend = static_cast<KDevMakeFrontend*>(part));
 
     // App frontend
@@ -234,6 +236,8 @@ void Core::initGlobalParts()
         return;
     service = *appFrontendOffers.begin();
     part = PartLoader::loadService(service, "KDevAppFrontend", api, this);
+    if (!part)
+        return;
     initPart(api->appFrontend = static_cast<KDevAppFrontend*>(part));
 
     // Global parts
@@ -248,6 +252,8 @@ void Core::initGlobalParts()
             continue;
         }
         part = PartLoader::loadService(*it, "KDevPart", api, this);
+        if (!part)
+            return;
         initPart(part);
         globalParts.append(part);
     }
@@ -525,6 +531,8 @@ void Core::openProject()
     KService::Ptr projectService = KService::serviceByName(projectPlugin);
     if (projectService) {
         KDevPart *part = PartLoader::loadService(projectService, "KDevProject", api, this);
+        if (!part)
+            return;
         initPart(api->project = static_cast<KDevProject*>(part));
     } else {
         KMessageBox::sorry(win, i18n("No project management plugin %1 found.").arg(projectPlugin));
@@ -538,6 +546,8 @@ void Core::openProject()
     if (!languageSupportOffers.isEmpty()) {
         KService *languageSupportService = *languageSupportOffers.begin();
         KDevPart *part = PartLoader::loadService(languageSupportService, "KDevLanguageSupport", api, this);
+        if (!part)
+            return;
         initPart(api->languageSupport = static_cast<KDevLanguageSupport*>(part));
     } else
         KMessageBox::sorry(win, i18n("No language plugin for %1 found.").arg(language));
@@ -556,6 +566,8 @@ void Core::openProject()
       
       if (loadparts.contains((*it)->name())){ // load the part if in loadparts
 	KDevPart *part = PartLoader::loadService(*it, "KDevPart", api, this);
+        if (!part)
+            return;
 	initPart(part);
 	localParts.append(part);
       }
@@ -580,6 +592,8 @@ void Core::openProject()
 	  if(keywordsMatch){
 	    loadparts << (*it)->name();
 	    KDevPart *part = PartLoader::loadService(*it, "KDevPart", api, this);
+            if (!part)
+                return;
 	    initPart(part);
 	    localParts.append(part);
 	  }
Index: src/partloader.cpp
===================================================================
RCS file: /home/kde/kdevelop/src/partloader.cpp,v
retrieving revision 1.6
diff -u -3 -p -r1.6 partloader.cpp
--- src/partloader.cpp	2001/07/17 19:36:48	1.6
+++ src/partloader.cpp	2001/09/30 01:11:35
@@ -16,6 +16,8 @@
 
 #include <kconfig.h>
 #include <kapp.h>
+#include <kmessagebox.h>
+#include <klocale.h>
 
 
 #include "kdevfactory.h"
@@ -101,7 +103,10 @@ KDevPart *PartLoader::loadService(KServi
 
     kdDebug(9000) << "Loading service " << service->name() << endl;
     KLibFactory *factory = factoryForService(service);
-    if (!factory->inherits("KDevFactory")) {
+    if (!factory || !factory->inherits("KDevFactory")) {
+        if (!factory) {
+            KMessageBox::error(0, i18n("Error: could not load part! Is it corrupt, binary incompatible or installed in the wrong directory, like $KDEDIR/lib/kde(2) instead of $KDEDIR/lib/kde3 ?"));
+        }
         kdDebug(9000) << "Does not have a KDevFactory" << endl;
         return 0;
     }  


More information about the KDevelop-devel mailing list