diff --git a/extensions/regexfilter.cpp b/extensions/regexfilter.cpp index 1c7b299..5855184 100644 --- a/extensions/regexfilter.cpp +++ b/extensions/regexfilter.cpp @@ -34,18 +34,22 @@ struct : QMainWindow { BOOL WINAPI DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { - std::lock_guard l(m); switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: { - QTimer::singleShot(0, [] { (window = new std::remove_pointer_t)->Initialize(); }); + QTimer::singleShot(0, [] + { + std::lock_guard l(m); + (window = new std::remove_pointer_t)->Initialize(); + }); } break; case DLL_PROCESS_DETACH: { if (lpReserved == NULL) // https://blogs.msdn.microsoft.com/oldnewthing/20120105-00/?p=8683 { + std::lock_guard l(m); delete window; window = nullptr; }