Mercurial > hg > orthanc-stone
changeset 1683:6594c9709d33
IsSceneAlive now ensures viewport is reachable
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Wed, 25 Nov 2020 12:16:11 +0100 |
parents | 84fe7089ccaa |
children | fb62c1522193 |
files | OrthancStone/Sources/Scene2DViewport/MeasureTool.cpp |
diffstat | 1 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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<IViewport::ILock> lock(GetViewportLock()); + return (lock != NULL); } void MeasureTool::OnSceneTransformChanged(