[libcamera-devel] [PATCH 1/2] qcam: Fix unregister of not registered timer

Laurent Pinchart laurent.pinchart at ideasonboard.com
Fri Sep 27 14:13:31 CEST 2019


Hi Niklas,

Thank you for the patch.

On Fri, Sep 27, 2019 at 04:30:22AM +0200, Niklas Söderlund wrote:
> If a unregistered timer is given to QtEventDispatcher::unregisterTimer()

s/If a/If an/

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

Nitpicking, I'd remove this blank line.

Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

> +	if (it == timerIds_.end())
> +		return;
> +
>  	timers_.erase(it->second);
>  	killTimer(it->second);
>  	timerIds_.erase(it);

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list