summaryrefslogtreecommitdiff
path: root/src/qcam
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-09-26 20:39:51 +0200
committerNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-10-01 15:24:59 +0200
commit82bf40e1f00a23430fd9ae9bc085d809369dc3a1 (patch)
tree9ff6f2a31e959105008da2d2547b76eb8221d61e /src/qcam
parentb13b134616613060505d776d2fef1446b139ec0f (diff)
qcam: Stop timer on timeout
Stopping the timer will reset the Timer::deadline_ field to 0 fixing potential bugs and call QtEventDispatcher::unregisterTimer() which will take care of the cleanup. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/qcam')
-rw-r--r--src/qcam/qt_event_dispatcher.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/qcam/qt_event_dispatcher.cpp b/src/qcam/qt_event_dispatcher.cpp
index 98d2472c..e39c6edb 100644
--- a/src/qcam/qt_event_dispatcher.cpp
+++ b/src/qcam/qt_event_dispatcher.cpp
@@ -130,10 +130,8 @@ void QtEventDispatcher::unregisterTimer(Timer *timer)
void QtEventDispatcher::timerEvent(QTimerEvent *event)
{
- auto it = timers_.find(event->timerId());
- timerIds_.erase(it->second);
- killTimer(it->first);
- timers_.erase(it);
+ Timer *timer = timers_[event->timerId()];
+ timer->stop();
}
void QtEventDispatcher::processEvents()