changeset 1684:fb62c1522193

Scene2D must be built first and deleted last!
author Benjamin Golinvaux <bgo@osimis.io>
date Wed, 25 Nov 2020 12:16:33 +0100
parents 6594c9709d33
children 7896aac14587
files OrthancStone/Sources/Scene2DViewport/ViewportController.h
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancStone/Sources/Scene2DViewport/ViewportController.h	Wed Nov 25 12:16:11 2020 +0100
+++ b/OrthancStone/Sources/Scene2DViewport/ViewportController.h	Wed Nov 25 12:16:33 2020 +0100
@@ -233,12 +233,17 @@
   private:
     double GetCanvasToSceneFactor() const;
 
+    // The scene can be used by the higher-level objects (including the
+    // measuring tools), possibly in their destructor, and so it must be 
+    // deleted last (and, thus, constructed first)
+    std::unique_ptr<Scene2D>   scene_;
+
     boost::weak_ptr<IViewport>                    viewport_;
+
     boost::weak_ptr<UndoStack>                    undoStackW_;  // Global stack, possibly shared by all viewports
     std::vector<boost::shared_ptr<MeasureTool> >  measureTools_;
     boost::shared_ptr<IFlexiblePointerTracker>    activeTracker_;  // TODO - Couldn't this be a "std::unique_ptr"?
 
-    std::unique_ptr<Scene2D>   scene_;
 
     // this is cached
     double  canvasToSceneFactor_;