summaryrefslogtreecommitdiffstats
path: root/src/core/web_event_factory.cpp
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2017-12-14 11:21:31 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2017-12-14 13:41:09 +0000
commitaead0729aaab970b95220bd864520d7635d7a33f (patch)
tree7d278bc724191afc169fb812f5b642e7b3d86fd3 /src/core/web_event_factory.cpp
parent8f7ae2efd14f837914512e2072ccf5d942a90b0f (diff)
Fix invalid access in currentTimeForEvent
The method currentTimeForEvent() tried to access the timestamp() method for a QEvent::Leave event. Leave events are regular QEvents and not QInputEvents, and thus have no such method. Change-Id: Iecc20d239b0e2a5b39b995dabdd7ca8fb44491aa Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/core/web_event_factory.cpp')
-rw-r--r--src/core/web_event_factory.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/core/web_event_factory.cpp b/src/core/web_event_factory.cpp
index 919ba730f..7245e29e6 100644
--- a/src/core/web_event_factory.cpp
+++ b/src/core/web_event_factory.cpp
@@ -1023,7 +1023,8 @@ static inline double currentTimeForEvent(const QEvent *event)
{
Q_ASSERT(event);
- if (const QInputEvent *inputEvent = static_cast<const QInputEvent *>(event)) {
+ if (event->type() != QEvent::Leave) {
+ const QInputEvent *inputEvent = static_cast<const QInputEvent *>(event);
if (inputEvent->timestamp())
return static_cast<double>(inputEvent->timestamp()) / 1000;
}