Fix T99661: Use after free converting edit mode curve object to mesh

The fix from c0fdf16561 was missing in one place. We don't
want to free the edit mode pointers, those are just copied because the
edit mode changes aren't present in the actual original data-block.
This commit is contained in:
Hans Goudey 2022-08-09 17:49:41 -05:00
parent a9a7460570
commit 90b7c3d05e
Notes: blender-bot 2023-02-14 06:00:46 +01:00
Referenced by issue #99661, Regression: Converting curve object to mesh makes object disappear from 3D view
1 changed files with 6 additions and 0 deletions

View File

@ -985,6 +985,12 @@ static Mesh *mesh_new_from_curve_type_object(const Object *object)
/* If evaluating the curve replaced object data with different data, free the original data. */
if (temp_data != temp_object->data) {
if (GS(temp_data->name) == ID_CU_LEGACY) {
/* Clear edit mode pointers that were explicitly copied to the temporary curve. */
Curve *curve = reinterpret_cast<Curve *>(temp_data);
curve->editfont = nullptr;
curve->editnurb = nullptr;
}
BKE_id_free(nullptr, temp_data);
}