mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-28 11:21:30 +00:00
Fix rare crash due to invalid pointer when vector::resize reallocate underlying memory (#15877)
This commit is contained in:
@@ -697,7 +697,8 @@ public:
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Resize by duplicating the last value.
|
// Resize by duplicating the last value.
|
||||||
this->values.resize(n, this->values./*back*/front());
|
T v = this->values./*back*/front();
|
||||||
|
this->values.resize(n, v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -772,8 +773,10 @@ public:
|
|||||||
|
|
||||||
if (this->values.empty())
|
if (this->values.empty())
|
||||||
this->values.resize(rhs_vec->size());
|
this->values.resize(rhs_vec->size());
|
||||||
else
|
else {
|
||||||
this->values.resize(rhs_vec->size(), this->values.front());
|
T v = this->values.front();
|
||||||
|
this->values.resize(rhs_vec->size(), v);
|
||||||
|
}
|
||||||
|
|
||||||
assert(default_index.size() == rhs_vec->size());
|
assert(default_index.size() == rhs_vec->size());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user