summaryrefslogtreecommitdiffstats
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>2011-03-25 11:32:54 -0300
commita4024296bf2e7685643b353d435ac575846ebc80 (patch)
treed562303af115197148cc4783b95b26d4edea25d0
parentf269b2a6af8134edbe1bfbc4d53e72ecbe61cdc6 (diff)
downloadshiboken-a4024296bf2e7685643b353d435ac575846ebc80.tar.gz
shiboken-a4024296bf2e7685643b353d435ac575846ebc80.tar.xz
shiboken-a4024296bf2e7685643b353d435ac575846ebc80.zip
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>
-rw-r--r--libshiboken/bindingmanager.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/libshiboken/bindingmanager.cpp b/libshiboken/bindingmanager.cpp
index ba9f77eb..07c9336b 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) {