Files
netgen/libsrc/meshing/global.cpp
Matthias Hochsteger 6ca5657c73 Fix race condition in mesh drawing with netgen pip package
When Draw() is running from python it
- sets the global mesh pointer (a weak pointer)
- tells the GUI thread to draw the mesh

The problem:
If the python script already finished, the mesh is dying before the GUI
thread picks it up for drawing. This does not happen for drawing a
function, since the NGSolve solution scene object already keeps a
shared_ptr to CF/GridFunction/mesh objects.

The fix:
Add a shared_ptr<Mesh> to the mesh scene object. This gets updated
automatically when the global weak_ptr is set (but only if the GUI was
loaded, that's why a callback is needed)
2026-01-26 13:57:15 +01:00

2.3 KiB