[Kde-bindings] KDE/kdebindings/generator/generators/smoke

Arno Rehn kde at arnorehn.de
Sat Nov 21 17:12:08 UTC 2009


SVN commit 1052427 by arnorehn:

Don't cache methods in findDestructor() - we add & remove methods while preparsing
and thus the method pointer can possibly become invalid.
This fixes a crash when generating the qtxml smoke lib.

CCMAIL: kde-bindings at kde.org



 M  +0 -6      helpers.cpp  


--- trunk/KDE/kdebindings/generator/generators/smoke/helpers.cpp #1052426:1052427
@@ -348,20 +348,14 @@
 
 const Method* Util::findDestructor(const Class* klass)
 {
-    static QHash<const Class*, const Method*> cache;
-    if (cache.contains(klass))
-        return cache[klass];
-    
     foreach (const Method& meth, klass->methods()) {
         if (meth.isDestructor()) {
-            cache[klass] = &meth;
             return &meth;
         }
     }
     const Method* dtor = 0;
     foreach (const Class::BaseClassSpecifier& bspec, klass->baseClasses()) {
         if ((dtor = findDestructor(bspec.baseClass))) {
-            cache[klass] = dtor;
             return dtor;
         }
     }



More information about the Kde-bindings mailing list