Boundbox on curves is somewhat unstable.
If some code outside the depsgraph evaluation context marks an object
as having the BoundDox dirty, the boundbox will go wrong until the
modifiers are evaluated again.
And that's what happens in the drawing loop (DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN).
The same curve type object appears twice in DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN:
- the first time the object->data is the curve data
- the second time the object->data is temporarily replaced by a mesh that has been evaluated
During this temporary replacement, the boundbox is marked as being dirty.
In the example shown in T94078, we see that the boundbox read by the
overlay engine gets wrong after the viewport is updated.
Solution
The solution proposed in this patch is to change the boundbox reference of the temporary objects,
so the boundbox of the non-temporary object (with the data curve) is not marked dirty.
An ideal solution might be to add a "boundbox" member to the Mesh struct.
Or replace by default the ob->data of the evaluated object by the final
mesh with modifiers.
Ref T94078