mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-14 08:38:45 +00:00
Fix LTMCanvasPicker SEGV on delete tab
.. not always, but sometimes !
This commit is contained in:
@@ -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())
|
||||
{
|
||||
|
||||
@@ -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(); }
|
||||
|
||||
Reference in New Issue
Block a user