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>
This commit is contained in:
Niklas Söderlund 2019-09-26 12:45:08 +02:00
parent f0b2582c49
commit b13b134616

View file

@ -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);