mirror of
https://github.com/opencv/opencv.git
synced 2025-06-13 04:52:53 +08:00
core: re-throw allocation exception if there is no fallback
This commit is contained in:
parent
28cb714a09
commit
8c4f886f5f
@ -355,15 +355,16 @@ void Mat::create(int d, const int* _sizes, int _type)
|
|||||||
#endif
|
#endif
|
||||||
if(!a)
|
if(!a)
|
||||||
a = a0;
|
a = a0;
|
||||||
CV_TRY
|
try
|
||||||
{
|
{
|
||||||
u = a->allocate(dims, size, _type, 0, step.p, 0, USAGE_DEFAULT);
|
u = a->allocate(dims, size, _type, 0, step.p, 0, USAGE_DEFAULT);
|
||||||
CV_Assert(u != 0);
|
CV_Assert(u != 0);
|
||||||
}
|
}
|
||||||
CV_CATCH_ALL
|
catch (...)
|
||||||
{
|
{
|
||||||
if(a != a0)
|
if (a == a0)
|
||||||
u = a0->allocate(dims, size, _type, 0, step.p, 0, USAGE_DEFAULT);
|
throw;
|
||||||
|
u = a0->allocate(dims, size, _type, 0, step.p, 0, USAGE_DEFAULT);
|
||||||
CV_Assert(u != 0);
|
CV_Assert(u != 0);
|
||||||
}
|
}
|
||||||
CV_Assert( step[dims-1] == (size_t)CV_ELEM_SIZE(flags) );
|
CV_Assert( step[dims-1] == (size_t)CV_ELEM_SIZE(flags) );
|
||||||
|
Loading…
Reference in New Issue
Block a user