Fix crash on plot deletion

This commit is contained in:
Rebecca Cox
2017-11-03 11:36:44 +01:00
parent 95f7f40b15
commit cac5fa42a5
3 changed files with 29 additions and 13 deletions

View File

@@ -23,18 +23,21 @@
#include <memory>
#include <vector>
#include <QPointer>
class QString;
class QwtPlot;
class RiuPlotAnnotationTool
{
public:
RiuPlotAnnotationTool(QwtPlot* plot) : m_plot(plot) {};
RiuPlotAnnotationTool() {};
~RiuPlotAnnotationTool();
void attachFormationNames(const std::vector<QString>& names, const std::vector<std::pair<double, double>> yPositions);
void attachFormationNames(QwtPlot* plot, const std::vector<QString>& names, const std::vector<std::pair<double, double>> yPositions);
void detachAllAnnotations();
private:
QwtPlot* m_plot;
std::vector<std::unique_ptr<QwtPlotMarker>> m_markers;
QPointer<QwtPlot> m_plot;
std::vector<QwtPlotMarker*> m_markers;
};