diff options
author | Hugo Lima <hugo.lima@openbossa.org> | 2010-03-16 13:43:27 -0300 |
---|---|---|
committer | Hugo Lima <hugo.lima@openbossa.org> | 2010-03-18 19:45:07 -0300 |
commit | 94e1c785c8d6f3dca195f1005fe0c3ee0f02ead5 (patch) | |
tree | d40240a164344f43281e270dd72ff15617cbd4f3 /libshiboken | |
parent | 59c0dc6bd2a86207d5f500d767bea98c8c16d3e9 (diff) |
Move the checks to verify if an object is invalid to Shiboken::cppObjectIsInvalid function.
Diffstat (limited to 'libshiboken')
-rw-r--r-- | libshiboken/basewrapper.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libshiboken/basewrapper.cpp b/libshiboken/basewrapper.cpp index a01fc57af..d2c541011 100644 --- a/libshiboken/basewrapper.cpp +++ b/libshiboken/basewrapper.cpp @@ -153,9 +153,12 @@ PyObject* SbkBaseWrapper_TpNew(PyTypeObject* subtype, PyObject*, PyObject*) bool cppObjectIsInvalid(PyObject* wrapper) { - if (wrapper == Py_None || ((Shiboken::SbkBaseWrapper*)wrapper)->validCppObject) + if (wrapper == Py_None + || wrapper->ob_type->ob_type != &Shiboken::SbkBaseWrapperType_Type + || ((Shiboken::SbkBaseWrapper*)wrapper)->validCppObject) { return false; - PyErr_SetString(PyExc_RuntimeError, "internal C++ object already deleted."); + } + PyErr_SetString(PyExc_RuntimeError, "Internal C++ object already deleted."); return true; } |