mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 07:13:02 +04:00
Fix copyTo on empty fixed-type matrices (#28343)
PR #27972 added _dst.create(size(), type()) in copyTo's empty() block. In Debug builds, Mat::release() was resetting flags to MAGIC_VAL, clearing the type information and causing assertion failures when destination has fixedType(). Preserve type flags in Mat::release() debug mode by using: flags = (flags & CV_MAT_TYPE_MASK) | MAGIC_VAL Thanks to @akretz for suggesting this better approach.
This commit is contained in:
@@ -553,7 +553,7 @@ void Mat::release()
|
||||
for(int i = 0; i < dims; i++)
|
||||
size.p[i] = 0;
|
||||
#ifdef _DEBUG
|
||||
flags = MAGIC_VAL;
|
||||
flags = (flags & CV_MAT_TYPE_MASK) | MAGIC_VAL;
|
||||
dims = rows = cols = 0;
|
||||
if(step.p != step.buf)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user