libcamera: timer: Stop timer when it is deleted
If a timer is running while it's deleted it is still register with the event dispatcher. This causes a segmentation fault when the timer time-out and its signal is emitted. Fix this my stopping the timer when it's deleted. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
@@ -17,6 +17,7 @@ class Timer
|
||||
{
|
||||
public:
|
||||
Timer();
|
||||
~Timer();
|
||||
|
||||
void start(unsigned int msec);
|
||||
void stop();
|
||||
|
||||
@@ -43,6 +43,11 @@ Timer::Timer()
|
||||
{
|
||||
}
|
||||
|
||||
Timer::~Timer()
|
||||
{
|
||||
stop();
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Start or restart the timer with a timeout of \a msec
|
||||
* \param[in] msec The timer duration in milliseconds
|
||||
|
||||
Reference in New Issue
Block a user