summaryrefslogtreecommitdiff
path: root/src/libcamera/base/thread.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcamera/base/thread.cpp')
-rw-r--r--src/libcamera/base/thread.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libcamera/base/thread.cpp b/src/libcamera/base/thread.cpp
index 75693c92..4ac72036 100644
--- a/src/libcamera/base/thread.cpp
+++ b/src/libcamera/base/thread.cpp
@@ -371,6 +371,12 @@ void Thread::run()
void Thread::finishThread()
{
+ /*
+ * Objects may have been scheduled for deletion right before the thread
+ * exited. Ensure they get deleted now, before the thread stops.
+ */
+ dispatchMessages(Message::Type::DeferredDelete);
+
data_->mutex_.lock();
data_->running_ = false;
data_->mutex_.unlock();