[libcamera-devel] [PATCH 1/2] qcam: Fix unregister of not registered timer
Niklas Söderlund
niklas.soderlund at ragnatech.se
Fri Sep 27 04:30:22 CEST 2019
If a 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 at ragnatech.se>
---
src/qcam/qt_event_dispatcher.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/qcam/qt_event_dispatcher.cpp b/src/qcam/qt_event_dispatcher.cpp
index 5ba451bf88cef6e8..6b332f6265d01fe0 100644
--- a/src/qcam/qt_event_dispatcher.cpp
+++ b/src/qcam/qt_event_dispatcher.cpp
@@ -120,6 +120,10 @@ 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);
--
2.23.0
More information about the libcamera-devel
mailing list