# HG changeset patch # User Benjamin Golinvaux # Date 1606302971 -3600 # Node ID 6594c9709d33b83b1200e301a483b596e726b329 # Parent 84fe7089ccaacf077cb637a7d1339ebbc4c61dcd IsSceneAlive now ensures viewport is reachable diff -r 84fe7089ccaa -r 6594c9709d33 OrthancStone/Sources/Scene2DViewport/MeasureTool.cpp --- a/OrthancStone/Sources/Scene2DViewport/MeasureTool.cpp Tue Nov 24 20:54:33 2020 +0100 +++ b/OrthancStone/Sources/Scene2DViewport/MeasureTool.cpp Wed Nov 25 12:16:11 2020 +0100 @@ -86,9 +86,11 @@ bool MeasureTool::IsSceneAlive() const { // since the lifetimes of the viewport, viewportcontroller (and the - // measuring tools inside it) are linked, the scene is always alive as - // long as "this" is alive - return true; + // measuring tools inside it) are linked, the scene is alive as + // long as the viewport is alive (which is technically not the case + // during its dtor) + std::unique_ptr lock(GetViewportLock()); + return (lock != NULL); } void MeasureTool::OnSceneTransformChanged(