Fix LTMCanvasPicker SEGV on delete tab

.. not always, but sometimes !
This commit is contained in:
Mark Liversedge
2014-06-20 17:24:41 +01:00
parent c8614b1abb
commit 0be0f08afa
2 changed files with 5 additions and 4 deletions

View File

@@ -19,8 +19,7 @@ LTMCanvasPicker::LTMCanvasPicker(QwtPlot *plot):
d_selectedCurve(NULL),
d_selectedPoint(-1)
{
QwtPlotCanvas *canvas = static_cast<QwtPlotCanvas*>(plot->canvas());
canvas = static_cast<QwtPlotCanvas*>(plot->canvas());
canvas->installEventFilter(this);
@@ -41,8 +40,8 @@ bool LTMCanvasPicker::event(QEvent *e)
bool LTMCanvasPicker::eventFilter(QObject *object, QEvent *e)
{
if ( object != (QObject *)plot()->canvas() )
return false;
// for our canvas ?
if (object != canvas) return false;
switch(e->type())
{

View File

@@ -11,6 +11,7 @@ class QPoint;
class QCustomEvent;
class QwtPlot;
class QwtPlotCurve;
class QwtPlotCanvas;
class LTMCanvasPicker: public QObject
{
@@ -27,6 +28,7 @@ signals:
void pointHover(QwtPlotCurve *, int);
private:
QwtPlotCanvas *canvas;
void select(const QPoint &, bool);
QwtPlot *plot() { return (QwtPlot *)parent(); }
const QwtPlot *plot() const { return (QwtPlot *)parent(); }