aboutsummaryrefslogtreecommitdiffstats
path: root/libshiboken/bindingmanager.cpp
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2011-09-13 17:43:16 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:17:14 -0300
commitc686942f6efbac4ac43cf859bfdd2c7209b783ea (patch)
tree39254222aca7f5bac8409a0078eaf5bbca2d1cf8 /libshiboken/bindingmanager.cpp
parent987010cb2c5740bf1cb7af54b2c6dc3142c44805 (diff)
Fix bug 995 - "QDeclarativeView.itemAt returns faulty reference. (leading to SEGFAULT)"
Diffstat (limited to 'libshiboken/bindingmanager.cpp')
-rw-r--r--libshiboken/bindingmanager.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/libshiboken/bindingmanager.cpp b/libshiboken/bindingmanager.cpp
index efca2532a..a8d4b0a06 100644
--- a/libshiboken/bindingmanager.cpp
+++ b/libshiboken/bindingmanager.cpp
@@ -71,7 +71,7 @@ public:
}
#endif
- SbkObjectType* identifyType(void* cptr, SbkObjectType* type, SbkObjectType* baseType) const
+ SbkObjectType* identifyType(void** cptr, SbkObjectType* type, SbkObjectType* baseType) const
{
Edges::const_iterator edgesIt = m_edges.find(type);
if (edgesIt != m_edges.end()) {
@@ -83,7 +83,17 @@ public:
return newType;
}
}
- return ((type->d && type->d->type_discovery) ? type->d->type_discovery(cptr, baseType) : 0);
+ void* typeFound = ((type->d && type->d->type_discovery) ? type->d->type_discovery(*cptr, baseType) : 0);
+ if (typeFound) {
+ // This "typeFound != type" is needed for backwards compatibility with old modules using a newer version of
+ // libshiboken because old versions of type_discovery function used to return a SbkObjectType* instead of
+ // a possible variation of the C++ instance pointer (*cptr).
+ if (typeFound != type)
+ *cptr = typeFound;
+ return type;
+ } else {
+ return 0;
+ }
}
};
@@ -265,6 +275,11 @@ void BindingManager::addClassInheritance(SbkObjectType* parent, SbkObjectType* c
SbkObjectType* BindingManager::resolveType(void* cptr, SbkObjectType* type)
{
+ return resolveType(&cptr, type);
+}
+
+SbkObjectType* BindingManager::resolveType(void** cptr, SbkObjectType* type)
+{
SbkObjectType* identifiedType = m_d->classHierarchy.identifyType(cptr, type, type);
return identifiedType ? identifiedType : type;
}