Fix: Crash when Bevel operation is performed on border edges

Fix #142045 crash on performing bevel operation on border edges.
When user selected both border edges and neigboring edges
(parallel to those border egdes) for the bevel operation,
the former were omitted during construction of BevVert objects
but their initial UV connectivity were recorded during call
to determine_uv_vert_connectivity function - specifically BMLoop
pointers were stored in BevelParams::uv_vert_maps member.
This later caused issues after rebuilding existing polygons
(bevel_rebuild_existing_polygons) since previously recorded
BMLoop pointers became invalid for border edges but still were
stored in uv_vert_maps (uv_vert_map_pop function was not called
for them since those loops were not related to BevVert objects).
This caused crash when accessing UV positions, when providing
invalid loop pointer to BM_ELEM_CD_GET_FLOAT_P function in bevel_merge_uvs.
This commit is contained in:
Piotr Makal
2025-07-17 09:17:54 -04:00
committed by Howard Trickey
parent 2fd36b0ab7
commit 6697dc2561

View File

@@ -334,7 +334,7 @@ enum AngleKind {
/** Container for loops representing UV verts which should be merged together in a UV map. */
using UVVertBucket = Set<BMLoop *>;
/** Mapping of vertex to UV vert buckets (i.e. loops belonging to that key `BMVert`). */
/** Mapping of vertex to UV vert buckets (i.e. loops belonging to that `BMVert` key). */
using UVVertMap = Map<BMVert *, Vector<UVVertBucket>>;
/** Bevel parameters and state. */
@@ -7970,8 +7970,8 @@ void BM_mesh_bevel(BMesh *bm,
bv = bevel_vert_construct(bm, &bp, v);
if (!limit_offset && bv) {
build_boundary(&bp, bv, true);
determine_uv_vert_connectivity(&bp, bm, v);
}
determine_uv_vert_connectivity(&bp, bm, v);
}
}
@@ -7985,6 +7985,7 @@ void BM_mesh_bevel(BMesh *bm,
bv = find_bevvert(&bp, v);
if (bv) {
build_boundary(&bp, bv, true);
determine_uv_vert_connectivity(&bp, bm, v);
}
}
}