From fb051f78de91db8ee5f5a08d68c4c0b4a31ccf11 Mon Sep 17 00:00:00 2001 From: Andrey Pavlenko Date: Wed, 28 Dec 2011 14:47:21 +0000 Subject: [PATCH] adjusting custom mat allocator when mat type is changed --- modules/core/src/matrix.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/core/src/matrix.cpp b/modules/core/src/matrix.cpp index 907cf06dcc..6c53e6429d 100644 --- a/modules/core/src/matrix.cpp +++ b/modules/core/src/matrix.cpp @@ -201,12 +201,12 @@ void Mat::create(int d, const int* _sizes, int _type) if( d == 0 ) return; flags = (_type & CV_MAT_TYPE_MASK) | MAGIC_VAL; - setSize(*this, d, _sizes, 0, allocator == 0); + setSize(*this, d, _sizes, 0, true); if( total() > 0 ) { #ifdef HAVE_TGPU - if( !allocator ) allocator = tegra::getAllocator(d, _sizes, _type); + if( !allocator || allocator == tegra::getAllocator() ) allocator = tegra::getAllocator(d, _sizes, _type); #endif if( !allocator ) {