Fix shared queue initialization 35/290835/1
authorHwankyu Jhun <h.jhun@samsung.com>
Tue, 4 Apr 2023 05:47:41 +0000 (05:47 +0000)
committerHwankyu Jhun <h.jhun@samsung.com>
Tue, 4 Apr 2023 05:47:41 +0000 (05:47 +0000)
Before running the worker thread, the shared queue must be allocated.
If it's not allocated, the thread will be crashed by the invalid access issue.

Change-Id: I9100ef14e458668452091c89bdeebd3f8beb7d3f
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/launchpad-process-pool/dbus.cc
src/launchpad-process-pool/worker.cc

index 3cf6571..d47c951 100644 (file)
@@ -123,8 +123,8 @@ class DBusManager {
     if (!disposed_)
       return;
 
-    thread_ = std::thread([&]() -> void { WorkerThread(); });
     queue_ = new tizen_base::SharedQueue<std::shared_ptr<DBusMessage>>();
+    thread_ = std::thread([&]() -> void { WorkerThread(); });
     disposed_ = false;
   }
 
index 9b261b4..ec8a4d6 100644 (file)
@@ -38,8 +38,8 @@ class Ender : public Worker::Job {
 }  // namespace
 
 Worker::Worker(std::string name) : name_(std::move(name)) {
-  thread_ = std::thread([&]() -> void { RunThread(); });
   queue_ = new tizen_base::SharedQueue<std::shared_ptr<Job>>();
+  thread_ = std::thread([&]() -> void { RunThread(); });
 }
 
 Worker::~Worker() {