From 8c4f886f5fbd7dfa9492dc83d5922fd90618c960 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Fri, 12 Oct 2018 19:10:06 +0000 Subject: [PATCH] core: re-throw allocation exception if there is no fallback --- modules/core/src/matrix.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/core/src/matrix.cpp b/modules/core/src/matrix.cpp index 5edf252c87..8433babc64 100644 --- a/modules/core/src/matrix.cpp +++ b/modules/core/src/matrix.cpp @@ -355,15 +355,16 @@ void Mat::create(int d, const int* _sizes, int _type) #endif if(!a) a = a0; - CV_TRY + try { u = a->allocate(dims, size, _type, 0, step.p, 0, USAGE_DEFAULT); CV_Assert(u != 0); } - CV_CATCH_ALL + catch (...) { - if(a != a0) - u = a0->allocate(dims, size, _type, 0, step.p, 0, USAGE_DEFAULT); + if (a == a0) + throw; + u = a0->allocate(dims, size, _type, 0, step.p, 0, USAGE_DEFAULT); CV_Assert(u != 0); } CV_Assert( step[dims-1] == (size_t)CV_ELEM_SIZE(flags) );