Lock the mutex in the callback functions 48/236848/2
authorHwankyu Jhun <h.jhun@samsung.com>
Tue, 23 Jun 2020 00:23:28 +0000 (09:23 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Tue, 23 Jun 2020 00:33:48 +0000 (09:33 +0900)
Change-Id: I13be0e6d75a0e768e2fd37bd0b090f4e665fb42a
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/media_key.cc

index 5a5763d..ce30c0c 100644 (file)
@@ -172,6 +172,7 @@ class MediaKey {
     }
 
     auto* handle = static_cast<MediaKey*>(data);
+    std::lock_guard<std::recursive_mutex> lock(handle->GetMutex());
     if (handle->cb_ == nullptr)
       return ECORE_CALLBACK_RENEW;
 
@@ -191,6 +192,7 @@ class MediaKey {
     }
 
     auto* handle = static_cast<MediaKey*>(data);
+    std::lock_guard<std::recursive_mutex> lock(handle->GetMutex());
     if (handle->cb_ == nullptr)
       return ECORE_CALLBACK_RENEW;