NumpyAllocator: check reference count before actual release, revert flann changes

This commit is contained in:
Maksim Shabunin
2015-06-17 12:07:57 +03:00
parent 26d9a7cd40
commit fef7509eed
2 changed files with 11 additions and 22 deletions

View File

@@ -190,9 +190,13 @@ public:
void deallocate(UMatData* u) const
{
if(u)
if(!u)
return;
PyEnsureGIL gil;
CV_Assert(u->urefcount >= 0);
CV_Assert(u->refcount >= 0);
if(u->refcount == 0)
{
PyEnsureGIL gil;
PyObject* o = (PyObject*)u->userdata;
Py_XDECREF(o);
delete u;