Page MenuHome

Fix T96289: Crash when accessing mesh via `ob.data` in a driver
ClosedPublic

Authored by Sybren A. Stüvel (sybren) on May 16 2022, 10:48 AM.

Details

Summary

Fix a crash when a driver variable targets an object and uses
data.shape_keys.key["name"].value in its expression.

The fix consists of adding an extra relation from the targeted object's
GEOMETRY component to the driver evaluation. This ensures that its
data pointer has been evaluated by the depsgraph and is safe to
follow.

This also resolves the concern raised on rB56407432a6aa.


As an alternative solution I tried using RNA_path_resolve_elements to
get the RNA path elements. Although the function itself works fine, it's
hard to use the resulting data for creating relations: it gives me the
datablocks, but that's not enough to create a relation. For the Object,
I need to create a relation from the GEOMETRY component, but for other
datablocks this can be different. Since this crash is caused by the call
to BKE_mesh_wrapper_ensure_subdivision(), I chose to limit the
solution to geometry data.

Diff Detail

Repository
rB Blender