aboutsummaryrefslogtreecommitdiffstats
path: root/libshiboken/basewrapper.cpp
diff options
context:
space:
mode:
authorJohn Ehresman <jpe@wingware.com>2013-06-16 18:10:53 -0400
committerJohn Cummings <jcummings2@users.sf.net>2013-06-24 18:03:20 +0200
commit79e32dd6c67cfbd0d0e2b163e6d1959ea5161465 (patch)
tree9a15a6092649732da54cfe9e4764a04824df699a /libshiboken/basewrapper.cpp
parentf060e1ce92fdb4714ca2cface9474db33f1d8e95 (diff)
Fix segfault when using shiboken.delete
When an object is deleted, invalidate / releaseWrapper needs to be called before cptr array is deleted. Change-Id: I82f71f569d5a0f52084fbe1cc3d7846e764c7ef6 Reviewed-by: John Cummings <jcummings2@users.sf.net>
Diffstat (limited to 'libshiboken/basewrapper.cpp')
-rw-r--r--libshiboken/basewrapper.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/libshiboken/basewrapper.cpp b/libshiboken/basewrapper.cpp
index 63b46bcd5..55f96a391 100644
--- a/libshiboken/basewrapper.cpp
+++ b/libshiboken/basewrapper.cpp
@@ -823,9 +823,19 @@ void callCppDestructors(SbkObject* pyObj)
threadSaver.save();
sbkType->d->cpp_dtor(pyObj->d->cptr[0]);
}
+
+ /* invalidate needs to be called before deleting pointer array because
+ it needs to delete entries for them from the BindingManager hash table;
+ also release wrapper explicitly if object contains C++ wrapper because
+ invalidate doesn't */
+ invalidate(pyObj);
+ if (pyObj->d->validCppObject && pyObj->d->containsCppWrapper) {
+ BindingManager::instance().releaseWrapper(pyObj);
+ }
+
delete[] pyObj->d->cptr;
pyObj->d->cptr = 0;
- invalidate(pyObj);
+ pyObj->d->validCppObject = false;
}
bool hasOwnership(SbkObject* pyObj)