comparison Applications/Samples/Common/RtViewerView.h @ 1619:4c9e68291467

Added code to remove the wheel callback in dtor, to prevent access to dead object
author Benjamin Golinvaux <bgo@osimis.io>
date Mon, 02 Nov 2020 17:55:35 +0100
parents 32e0c007789d
children 52b8b96cb55f
comparison
equal deleted inserted replaced
1618:9a52bac0c2a7 1619:4c9e68291467
50 VolumeProjection projection) 50 VolumeProjection projection)
51 : app_(app) 51 : app_(app)
52 , currentPlane_(0) 52 , currentPlane_(0)
53 , projection_(projection) 53 , projection_(projection)
54 , ctLayer_(0) 54 , ctLayer_(0)
55 , canvasId_(canvasId)
55 { 56 {
56 viewport_ = CreateViewport(canvasId); 57 viewport_ = CreateViewport(canvasId);
57 FLOATING_INFOTEXT_LAYER_ZINDEX = 6; 58 FLOATING_INFOTEXT_LAYER_ZINDEX = 6;
58 FIXED_INFOTEXT_LAYER_ZINDEX = 7; 59 FIXED_INFOTEXT_LAYER_ZINDEX = 7;
60 }
61
62 ~RtViewerView()
63 {
64 CleanupViewportEvents();
59 } 65 }
60 66
61 /** 67 /**
62 This method is called when the scene transform changes. It allows to 68 This method is called when the scene transform changes. It allows to
63 recompute the visual elements whose content depend upon the scene transform 69 recompute the visual elements whose content depend upon the scene transform
110 private: 116 private:
111 void SetInfoDisplayMessage(const std::string& key, 117 void SetInfoDisplayMessage(const std::string& key,
112 const std::string& value); 118 const std::string& value);
113 boost::shared_ptr<RtViewerApp> GetApp(); 119 boost::shared_ptr<RtViewerApp> GetApp();
114 boost::shared_ptr<IViewport> CreateViewport(const std::string& canvasId); 120 boost::shared_ptr<IViewport> CreateViewport(const std::string& canvasId);
121 void CleanupViewportEvents();
115 void DisplayInfoText(); 122 void DisplayInfoText();
116 void HideInfoText(); 123 void HideInfoText();
117 void DisplayFloatingCtrlInfoText(const PointerEvent& e); 124 void DisplayFloatingCtrlInfoText(const PointerEvent& e);
118 125
119 void SetCtVolumeSlicer(const boost::shared_ptr<IVolumeSlicer>& volume, 126 void SetCtVolumeSlicer(const boost::shared_ptr<IVolumeSlicer>& volume,
139 int FLOATING_INFOTEXT_LAYER_ZINDEX; 146 int FLOATING_INFOTEXT_LAYER_ZINDEX;
140 int FIXED_INFOTEXT_LAYER_ZINDEX; 147 int FIXED_INFOTEXT_LAYER_ZINDEX;
141 boost::shared_ptr<IViewport> viewport_; 148 boost::shared_ptr<IViewport> viewport_;
142 149
143 int ctLayer_; 150 int ctLayer_;
151 std::string canvasId_;
144 }; 152 };
145 } 153 }