From b82d8d5523016cf22678e32fddb5bd79993a2452 Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Tue, 18 Dec 2018 12:15:18 -0500 Subject: [PATCH] forgot how lambdas work --- extensions/regexfilter.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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; }