diff --git a/GUI/extensions.cpp b/GUI/extensions.cpp index 99b69ae..9893e5a 100644 --- a/GUI/extensions.cpp +++ b/GUI/extensions.cpp @@ -20,20 +20,20 @@ std::map LoadExtensions() file.chop(sizeof("dll")); extensionNames[extensionNumber] = file.split("_")[1]; } - extenMutex.lock(); + std::shared_lock extenLock(extenMutex); extensions = newExtensions; - extenMutex.unlock(); return extensionNames; } bool DispatchSentenceToExtensions(std::wstring& sentence, std::unordered_map miscInfo) { + bool success = true; wchar_t* sentenceBuffer = (wchar_t*)malloc((sentence.size() + 1) * sizeof(wchar_t)); wcscpy_s(sentenceBuffer, sentence.size() + 1, sentence.c_str()); InfoForExtension* miscInfoLinkedList = new InfoForExtension; InfoForExtension* miscInfoTraverser = miscInfoLinkedList; for (auto& i : miscInfo) miscInfoTraverser = miscInfoTraverser->nextProperty = new InfoForExtension{ i.first.c_str(), i.second, nullptr }; - extenMutex.lock_shared(); + std::shared_lock extenLock(extenMutex); try { for (auto i : extensions) @@ -43,10 +43,9 @@ bool DispatchSentenceToExtensions(std::wstring& sentence, std::unordered_map 0; + delete miscInfoLinkedList; + return success; }