From 91ca834be921b149324ad72818f1e137bbc25788 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Mon, 3 Feb 2014 14:46:22 +0400 Subject: [PATCH] bug fix for issue 3470 --- modules/python/src2/cv2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/python/src2/cv2.cpp b/modules/python/src2/cv2.cpp index beb67b4c3..cd9c55e0d 100644 --- a/modules/python/src2/cv2.cpp +++ b/modules/python/src2/cv2.cpp @@ -189,7 +189,6 @@ public: UMatData* allocate(PyObject* o, int dims, const int* sizes, int type, size_t* step) const { UMatData* u = new UMatData(this); - u->refcount = 1; u->data = u->origdata = (uchar*)PyArray_DATA((PyArrayObject*) o); npy_intp* _strides = PyArray_STRIDES((PyArrayObject*) o); for( int i = 0; i < dims - 1; i++ ) @@ -416,6 +415,7 @@ static bool pyopencv_to(PyObject* o, Mat& m, const ArgInfo info) m = Mat(ndims, size, type, PyArray_DATA(oarr), step); m.u = g_numpyAllocator.allocate(o, ndims, size, type, step); + m.addref(); if( !needcopy ) {