aboutsummaryrefslogtreecommitdiffstats
path: root/libshiboken
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2011-03-24 17:20:42 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:15:19 -0300
commit55c0296417d146c999d0b2ba067c6e488bc6f416 (patch)
treebd6aa3b51d0acc611d35f5fba9eb7ee2168c3bc2 /libshiboken
parent3034659e09923a9417e244d5c3c656da30813373 (diff)
Don't return a overload method if the object is dieing.
Reviewer: Renato Araújo <renato.filho@openbossa.org> Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'libshiboken')
-rw-r--r--libshiboken/bindingmanager.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/libshiboken/bindingmanager.cpp b/libshiboken/bindingmanager.cpp
index ba9f77eb3..07c9336b8 100644
--- a/libshiboken/bindingmanager.cpp
+++ b/libshiboken/bindingmanager.cpp
@@ -216,7 +216,9 @@ SbkObject* BindingManager::retrieveWrapper(const void* cptr)
PyObject* BindingManager::getOverride(const void* cptr, const char* methodName)
{
SbkObject* wrapper = retrieveWrapper(cptr);
- if (!wrapper)
+ // The refcount can be 0 if the object is dieing and someone called
+ // a virtual method from the destructor
+ if (!wrapper || ((PyObject*)wrapper)->ob_refcnt == 0)
return 0;
if (wrapper->ob_dict) {