CameraManager: Ensure we cleanup on failure
If the CameraManager fails to initialise at startup during CameraManager::Private::init(), then the run() function will prepare the thread for operations, but the thread will immediately close without executing any cleanup. This can leave instantiated objects such as the EventNotifier registered by the udev enumerator constructed in a thread which no longer exists. The destructor of those objects can then fire an assertion that they are being executed from an incorrect thread while performing their cleanup. Ensure that the failure path does not result in reporting thread ownership assertions by performing cleanup correctly on the CameraManager thread before it closes. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
8fceb6ab1d
commit
dcb90f13cf
1 changed files with 3 additions and 1 deletions
|
@ -80,8 +80,10 @@ void CameraManager::Private::run()
|
|||
mutex_.unlock();
|
||||
cv_.notify_one();
|
||||
|
||||
if (ret < 0)
|
||||
if (ret < 0) {
|
||||
cleanup();
|
||||
return;
|
||||
}
|
||||
|
||||
/* Now start processing events and messages. */
|
||||
exec();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue