aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2018-04-25 16:00:53 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2018-05-29 18:16:06 +0000
commit5e221d15170be49086f0ab8671e1b2b7831dd252 (patch)
tree178091ce05452c161d1a6468a2538175d1c5d935
parentdba93db9a143ebf1e74f9fdf399b81b75e44f426 (diff)
QQuickPointerEvent: guard all access to m_event
QQuickWindowPrivate::pointerEventInstance(device, eventType) returns a pointer event which is not based on a QEvent: m_event will be null. This is useful for delivering hover events, but the qDebug operator<< crashes when it tries to print the timestamp, if we don't check for null m_event. Change-Id: Id3a93a1ffcae78cbf287f724da9c012a6b546b0b Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
-rw-r--r--src/quick/items/qquickevents_p_p.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/quick/items/qquickevents_p_p.h b/src/quick/items/qquickevents_p_p.h
index bb6726706d..b5596801b7 100644
--- a/src/quick/items/qquickevents_p_p.h
+++ b/src/quick/items/qquickevents_p_p.h
@@ -428,8 +428,8 @@ public: // helpers for C++ only (during event delivery)
virtual bool allPointsAccepted() const = 0;
virtual bool allUpdatedPointsAccepted() const = 0;
virtual bool allPointsGrabbed() const = 0;
- bool isAccepted() { return m_event->isAccepted(); }
- void setAccepted(bool accepted) { m_event->setAccepted(accepted); }
+ bool isAccepted() { return m_event ? m_event->isAccepted() : false; }
+ void setAccepted(bool accepted) { if (m_event) m_event->setAccepted(accepted); }
QVector<QPointF> unacceptedPressedPointScenePositions() const;
virtual int pointCount() const = 0;
@@ -439,7 +439,7 @@ public: // helpers for C++ only (during event delivery)
virtual void clearGrabbers() const = 0;
virtual bool hasExclusiveGrabber(const QQuickPointerHandler *handler) const = 0;
- ulong timestamp() const { return m_event->timestamp(); }
+ ulong timestamp() const { return m_event ? m_event->timestamp() : 0; }
protected:
QQuickPointerDevice *m_device;