diff options
author | Renato Filho <renato.filho@openbossa.org> | 2011-05-31 15:43:57 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:15:24 -0300 |
commit | a2dac99260317da72265cc2a69b97a4353eda791 (patch) | |
tree | 3ea1f0a914b41657e4edb6ae2cc0d52282603f65 /libshiboken/basewrapper.cpp | |
parent | ab5690f7a11f280409dc7f8ce17cb528e2829834 (diff) |
Created the function 'removeReference', used to remove a specific
reference from other object.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'libshiboken/basewrapper.cpp')
-rw-r--r-- | libshiboken/basewrapper.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libshiboken/basewrapper.cpp b/libshiboken/basewrapper.cpp index e53e495d4..8dc931727 100644 --- a/libshiboken/basewrapper.cpp +++ b/libshiboken/basewrapper.cpp @@ -1096,6 +1096,22 @@ void keepReference(SbkObject* self, const char* key, PyObject* referredObject, b } } +void removeReference(SbkObject* self, const char* key, PyObject* referredObject) +{ + if (!referredObject || (referredObject == Py_None)) + return; + + if (!self->d->referredObjects) + return; + + RefCountMap& refCountMap = *(self->d->referredObjects); + RefCountMap::iterator iter = refCountMap.find(key); + if (iter != refCountMap.end()) { + decRefPyObjectList(iter->second); + refCountMap.erase(iter); + } +} + void clearReferences(SbkObject* self) { if (!self->d->referredObjects) |