diff options
Diffstat (limited to 'messages.cpp')
-rw-r--r-- | messages.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/messages.cpp b/messages.cpp index 8a909c1..15972e4 100644 --- a/messages.cpp +++ b/messages.cpp @@ -19,6 +19,7 @@ wstring new_key; HANDLE new_key_hcnt = NULL; +HANDLE new_key_hcnt_mutex = NULL; bool _terminate = false; BOOL isProtoMetaContacts(HANDLE hContact); @@ -78,6 +79,8 @@ int RecvMsgSvc(WPARAM w, LPARAM l) s2 += _tcslen(_T("-----END PGP PRIVATE KEY BLOCK-----")); } new_key.append(str.substr(s1,s2-s1)); + WaitForSingleObject(new_key_hcnt_mutex, INFINITE); + new_key_hcnt_mutex = CreateMutex(NULL, FALSE, NULL); new_key_hcnt = hContact; ShowNewKeyDialog(); return CallService(MS_PROTO_CHAINRECV, w, l); @@ -204,6 +207,8 @@ int RecvMsgSvc(WPARAM w, LPARAM l) DBWriteContactSettingString(hContact, szGPGModuleName, "InKeyID", out.substr(s, s2-s).c_str()); } void ShowLoadKeyPasswordWindow(); + WaitForSingleObject(new_key_hcnt_mutex, INFINITE); + new_key_hcnt_mutex = CreateMutex(NULL, FALSE, NULL); new_key_hcnt = hContact; ShowLoadKeyPasswordWindow(); wstring cmd2 = cmd; @@ -513,6 +518,7 @@ int TestHook(WPARAM w, LPARAM l) static BOOL CALLBACK DlgProcKeyPassword(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { HANDLE hContact = new_key_hcnt; + CloseHandle(new_key_hcnt_mutex); TCHAR *tmp = NULL; char *inkeyid = UniGetContactSettingUtf(hContact, szGPGModuleName, "InKeyID", ""); switch (msg) |