summaryrefslogtreecommitdiff
path: root/src/qcam
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-09-26 12:45:08 +0200
committerNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-09-27 21:30:37 +0200
commitb13b134616613060505d776d2fef1446b139ec0f (patch)
tree3d90049b288c14ab38e9d1ea59ff95016d30eb9b /src/qcam
parentf0b2582c4961ce9e5b637a2a326aa59ebc905e52 (diff)
qcam: Fix unregister of not registered timer
If an unregistered timer is given to QtEventDispatcher::unregisterTimer() an error is printed and Qt gets confused and locks up. Fix this by following the libcamera documentation that passing a unregistered timer is a no-op. 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.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/qcam/qt_event_dispatcher.cpp b/src/qcam/qt_event_dispatcher.cpp
index 5ba451bf..98d2472c 100644
--- a/src/qcam/qt_event_dispatcher.cpp
+++ b/src/qcam/qt_event_dispatcher.cpp
@@ -120,6 +120,9 @@ void QtEventDispatcher::registerTimer(Timer *timer)
void QtEventDispatcher::unregisterTimer(Timer *timer)
{
auto it = timerIds_.find(timer);
+ if (it == timerIds_.end())
+ return;
+
timers_.erase(it->second);
killTimer(it->second);
timerIds_.erase(it);