Fix reachable Q_UNREACHABLE() when Geometry lacks a required attribute


attributeBySemantic() hit Q_UNREACHABLE() -- undefined behavior in
release builds -- whenever a custom QQuick3DGeometry assigned to
ConvexMeshShape.geometry or TriangleMeshShape.geometry was missing a
position (or, for indexed geometry, index) attribute. This is reachable
through ordinary API misuse, not just adversarial content, so it's not
just defensive programming: reverting this change makes the added test
abort with "ASSERT failure in Q_UNREACHABLE(): ... qmeshshape.cpp, line
38" (exit code 134); with the fix, a clean qWarning() and exit code 0.

Change it to report failure via a bool return and have all three call
sites fail gracefully with a qWarning(), matching the existing
validation checks in the same functions.

Adds a regression test exercising both ConvexMeshShape and
TriangleMeshShape with a geometry that has vertex data but no position
attribute (NoPositionGeometry, following the existing examplegeometry.cpp
pattern from the geometry test), asserting the world keeps simulating
instead of crashing. No rendering is involved, so the scene is a plain
Node rather than a View3D.

Pick-to: 6.12 6.11 6.8
Change-Id: I0fea9e7e8b5b0fc6d3ad6745754867d5102abb27
Reviewed-by: Kristoffer Skau <kristoffer.skau@qt.io>
commit06986e415d9a3ffd21163fb9a7dfbe45daa2dbc3
parent643ba0db4da80c510be0da0df653ce53a46dd545
authorJonas Karlsson <jonas.karlsson@qt.io>
committerJonas Karlsson <jonas.karlsson@qt.io>
commit timeWed, 12 Aug 2026 06:24:41 +0000