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

List:       kde-commits
Subject:    [smokegen/parentintrospection] generators/smoke: don't crash if the parent lib isn't found
From:       Arno Rehn <arno () arnorehn ! de>
Date:       2012-12-24 22:52:04
Message-ID: 20121224225204.F1D7FA60C8 () git ! kde ! org
[Download RAW message or body]

Git commit 88c00b5547778a69cc8c73b06699799978ca04c2 by Arno Rehn.
Committed on 24/12/2012 at 23:51.
Pushed by arnorehn into branch 'parentintrospection'.

don't crash if the parent lib isn't found

M  +12   -5    generators/smoke/helpers.cpp

http://commits.kde.org/smokegen/88c00b5547778a69cc8c73b06699799978ca04c2

diff --git a/generators/smoke/helpers.cpp b/generators/smoke/helpers.cpp
index 032c670..f6a12e2 100644
--- a/generators/smoke/helpers.cpp
+++ b/generators/smoke/helpers.cpp
@@ -124,15 +124,19 @@ static Smoke* loadSmokeModule(QString moduleName) {
     QString init_name = "init_" + moduleName + "_Smoke";
     InitSmokeFn init = (InitSmokeFn) lib.resolve(init_name.toLatin1());
 
-    if (!init)
-        qFatal("Couldn't resolve %s: %s", qPrintable(init_name), \
qPrintable(lib.errorString())); +    if (!init) {
+        qWarning("Couldn't resolve %s: %s", qPrintable(init_name), \
qPrintable(lib.errorString())); +        return 0;
+    }
 
     (*init)();
 
     QString smoke_name = moduleName + "_Smoke";
     Smoke** smoke = (Smoke**) lib.resolve(smoke_name.toLatin1());
-    if (!smoke)
-        qFatal("Couldn't resolve %s: %s", qPrintable(smoke_name), \
qPrintable(lib.errorString())); +    if (!smoke) {
+        qWarning("Couldn't resolve %s: %s", qPrintable(smoke_name), \
qPrintable(lib.errorString())); +        return 0;
+    }
 
     return *smoke;
 }
@@ -198,7 +202,10 @@ void Util::preparse(QSet<Type*> *usedTypes, QSet<const Class*> \
*superClasses, co  
     QList<Smoke*> parentModules;
     foreach (QString module, Options::parentModules) {
-        parentModules << loadSmokeModule(module);
+        Smoke *smoke = loadSmokeModule(module);
+        if (smoke) {
+            parentModules << smoke;
+        }
     }
 
     // add all functions as methods to a class called 'QGlobalSpace' or a class that \
represents a namespace


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

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