Mercurial > hg > svgui
comparison layer/Colour3DPlotLayer.cpp @ 1242:b10bd0611d16
Fix various "model deleted with no aboutToDelete notification" warnings (and one associated potential memory leak)
author | Chris Cannam |
---|---|
date | Wed, 22 Feb 2017 12:01:39 +0000 |
parents | 4d0ca1ab4cd0 |
children | 3ec95b7d1bfc |
comparison
equal
deleted
inserted
replaced
1240:c2e923aa4015 | 1242:b10bd0611d16 |
---|---|
68 } | 68 } |
69 | 69 |
70 Colour3DPlotLayer::~Colour3DPlotLayer() | 70 Colour3DPlotLayer::~Colour3DPlotLayer() |
71 { | 71 { |
72 invalidateRenderers(); | 72 invalidateRenderers(); |
73 if (m_peakCache) m_peakCache->aboutToDelete(); | |
73 delete m_peakCache; | 74 delete m_peakCache; |
74 } | 75 } |
75 | 76 |
76 ColourScaleType | 77 ColourScaleType |
77 Colour3DPlotLayer::convertToColourScale(int value) | 78 Colour3DPlotLayer::convertToColourScale(int value) |
133 } | 134 } |
134 | 135 |
135 void | 136 void |
136 Colour3DPlotLayer::setModel(const DenseThreeDimensionalModel *model) | 137 Colour3DPlotLayer::setModel(const DenseThreeDimensionalModel *model) |
137 { | 138 { |
139 SVDEBUG << "Colour3DPlotLayer::setModel(" << model << ")" << endl; | |
140 | |
138 if (m_model == model) return; | 141 if (m_model == model) return; |
139 const DenseThreeDimensionalModel *oldModel = m_model; | 142 const DenseThreeDimensionalModel *oldModel = m_model; |
140 m_model = model; | 143 m_model = model; |
141 if (!m_model || !m_model->isOK()) return; | 144 if (!m_model || !m_model->isOK()) return; |
142 | 145 |
153 m_peakResolution = 64; | 156 m_peakResolution = 64; |
154 } else if (model->getResolution() > 2) { | 157 } else if (model->getResolution() > 2) { |
155 m_peakResolution = 128; | 158 m_peakResolution = 128; |
156 } | 159 } |
157 | 160 |
161 if (m_peakCache) m_peakCache->aboutToDelete(); | |
158 delete m_peakCache; | 162 delete m_peakCache; |
159 m_peakCache = 0; | 163 m_peakCache = 0; |
160 | 164 |
161 invalidateRenderers(); | 165 invalidateRenderers(); |
162 invalidateMagnitudes(); | 166 invalidateMagnitudes(); |
175 void | 179 void |
176 Colour3DPlotLayer::cacheInvalid(sv_frame_t /* startFrame */, | 180 Colour3DPlotLayer::cacheInvalid(sv_frame_t /* startFrame */, |
177 sv_frame_t /* endFrame */) | 181 sv_frame_t /* endFrame */) |
178 { | 182 { |
179 //!!! should do this only if the range is visible | 183 //!!! should do this only if the range is visible |
184 if (m_peakCache) m_peakCache->aboutToDelete(); | |
180 delete m_peakCache; | 185 delete m_peakCache; |
181 m_peakCache = 0; | 186 m_peakCache = 0; |
182 | 187 |
183 invalidateRenderers(); | 188 invalidateRenderers(); |
184 invalidateMagnitudes(); | 189 invalidateMagnitudes(); |