use unique lock for replacing extensions and fix extensions with _ in them

This commit is contained in:
Akash Mozumdar 2018-10-07 23:32:31 -04:00
parent a21ee5bba4
commit 9929c3fac1

View File

@ -18,9 +18,10 @@ std::map<int, QString> LoadExtensions()
int extensionNumber = file.split("_")[0].toInt();
newExtensions[extensionNumber] = (ExtensionFunction)GetProcAddress(GetModuleHandleW(file.toStdWString().c_str()), "OnNewSentence");
file.chop(sizeof("dll"));
extensionNames[extensionNumber] = file.split("_")[1];
file.remove(0, file.indexOf("_") + 1);
extensionNames[extensionNumber] = file;
}
std::shared_lock<std::shared_mutex> extenLock(extenMutex);
std::unique_lock<std::shared_mutex> extenLock(extenMutex);
extensions = newExtensions;
return extensionNames;
}