comparison OrthancStone/Sources/Scene2DViewport/MeasureTool.cpp @ 1683:6594c9709d33

IsSceneAlive now ensures viewport is reachable
author Benjamin Golinvaux <bgo@osimis.io>
date Wed, 25 Nov 2020 12:16:11 +0100
parents 646e581e115b
children 9ac2a65d4172
comparison
equal deleted inserted replaced
1682:84fe7089ccaa 1683:6594c9709d33
84 } 84 }
85 85
86 bool MeasureTool::IsSceneAlive() const 86 bool MeasureTool::IsSceneAlive() const
87 { 87 {
88 // since the lifetimes of the viewport, viewportcontroller (and the 88 // since the lifetimes of the viewport, viewportcontroller (and the
89 // measuring tools inside it) are linked, the scene is always alive as 89 // measuring tools inside it) are linked, the scene is alive as
90 // long as "this" is alive 90 // long as the viewport is alive (which is technically not the case
91 return true; 91 // during its dtor)
92 std::unique_ptr<IViewport::ILock> lock(GetViewportLock());
93 return (lock != NULL);
92 } 94 }
93 95
94 void MeasureTool::OnSceneTransformChanged( 96 void MeasureTool::OnSceneTransformChanged(
95 const ViewportController::SceneTransformChanged& message) 97 const ViewportController::SceneTransformChanged& message)
96 { 98 {