[libcamera-devel,v3,3/3] qcam: Fix timers not emitting timeout signal

Message ID 20190930215906.1058301-4-niklas.soderlund@ragnatech.se
State Accepted
Headers show
Series
  • qcam: Fix issues in the Qt event dispatcher
Related show

Commit Message

Niklas Söderlund Sept. 30, 2019, 9:59 p.m. UTC
The timer signal was never emitted in QtEventDispatcher::timerEvent(),
this results in timers not working as designed running under the Qt
event loop. Fix this by emitting the signal on timeout.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
---
 src/qcam/qt_event_dispatcher.cpp | 1 +
 1 file changed, 1 insertion(+)

Comments

Laurent Pinchart Oct. 1, 2019, 1:04 a.m. UTC | #1
Hi Niklas,

Thank you for the patch.

On Mon, Sep 30, 2019 at 11:59:06PM +0200, Niklas Söderlund wrote:
> The timer signal was never emitted in QtEventDispatcher::timerEvent(),
> this results in timers not working as designed running under the Qt
> event loop. Fix this by emitting the signal on timeout.
> 
> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>

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

> ---
>  src/qcam/qt_event_dispatcher.cpp | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/qcam/qt_event_dispatcher.cpp b/src/qcam/qt_event_dispatcher.cpp
> index 43588ef081a3f633..d7d1fed290851e6e 100644
> --- a/src/qcam/qt_event_dispatcher.cpp
> +++ b/src/qcam/qt_event_dispatcher.cpp
> @@ -134,6 +134,7 @@ void QtEventDispatcher::timerEvent(QTimerEvent *event)
>  	Timer *timer = it->second;
>  
>  	timer->stop();
> +	timer->timeout.emit(timer);
>  }
>  
>  void QtEventDispatcher::processEvents()

Patch

diff --git a/src/qcam/qt_event_dispatcher.cpp b/src/qcam/qt_event_dispatcher.cpp
index 43588ef081a3f633..d7d1fed290851e6e 100644
--- a/src/qcam/qt_event_dispatcher.cpp
+++ b/src/qcam/qt_event_dispatcher.cpp
@@ -134,6 +134,7 @@  void QtEventDispatcher::timerEvent(QTimerEvent *event)
 	Timer *timer = it->second;
 
 	timer->stop();
+	timer->timeout.emit(timer);
 }
 
 void QtEventDispatcher::processEvents()