diff OrthancStone/Sources/Scene2DViewport/ViewportController.h @ 1606:874e178f34e9

- ViewportController now has weak ptr to Viewport - Measuring tools + related commands and all trackers now store only a weak_ptr to the Viewport and lock() on demand for usage - LayerHolder and FixedPoint aligner store only a weak_ptr to the Viewport, too - Fixed float/double warning in GrayscaleWindowingSceneTracker
author Benjamin Golinvaux <bgo@osimis.io>
date Wed, 28 Oct 2020 20:14:34 +0100
parents 8563ea5d8ae4
children fb62c1522193
line wrap: on
line diff
--- a/OrthancStone/Sources/Scene2DViewport/ViewportController.h	Wed Oct 28 20:06:55 2020 +0100
+++ b/OrthancStone/Sources/Scene2DViewport/ViewportController.h	Wed Oct 28 20:14:34 2020 +0100
@@ -88,7 +88,7 @@
                                         SceneTransformChanged, \
                                         ViewportController);
 
-    explicit ViewportController(boost::shared_ptr<IViewport> viewport);
+    explicit ViewportController(boost::weak_ptr<IViewport> viewport);
 
     ~ViewportController();
 
@@ -233,7 +233,7 @@
   private:
     double GetCanvasToSceneFactor() const;
 
-    boost::shared_ptr<IViewport>                  viewport_;
+    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"?