1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

fix opencv/opencv#20594 - exception handling with refcounts

This commit is contained in:
Dale Phurrough
2021-08-24 18:56:25 +02:00
parent 9bda96d39e
commit 54a9e00970
3 changed files with 66 additions and 28 deletions
+2 -3
View File
@@ -749,18 +749,17 @@ Mat::Mat(const Mat& m, const Rect& roi)
data += roi.x*esz;
CV_Assert( 0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols &&
0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows );
if( u )
CV_XADD(&u->refcount, 1);
if( roi.width < m.cols || roi.height < m.rows )
flags |= SUBMATRIX_FLAG;
step[0] = m.step[0]; step[1] = esz;
updateContinuityFlag();
addref();
if( rows <= 0 || cols <= 0 )
{
release();
rows = cols = 0;
release();
}
}