From dd6ac172c4f814fa4b5ace6caca80d00d7e01ac8 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 20 Feb 2020 21:23:22 +0300 Subject: bunch of useless threads replaced with a call of ProtoBroadcastAsync --- protocols/Tox/src/tox_proto.h | 1 - protocols/Tox/src/tox_search.cpp | 10 ++-------- 2 files changed, 2 insertions(+), 9 deletions(-) (limited to 'protocols/Tox/src') diff --git a/protocols/Tox/src/tox_proto.h b/protocols/Tox/src/tox_proto.h index 62ecf196e8..8b357a0dce 100644 --- a/protocols/Tox/src/tox_proto.h +++ b/protocols/Tox/src/tox_proto.h @@ -167,7 +167,6 @@ private: // contacts search void __cdecl SearchByNameAsync(void *arg); - void __cdecl SearchFailedAsync(void *arg); static INT_PTR CALLBACK SearchDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); diff --git a/protocols/Tox/src/tox_search.cpp b/protocols/Tox/src/tox_search.cpp index 83e4b883cb..b36b66e80c 100644 --- a/protocols/Tox/src/tox_search.cpp +++ b/protocols/Tox/src/tox_search.cpp @@ -49,12 +49,6 @@ void CToxProto::SearchByNameAsync(void *arg) mir_free(arg); } -void CToxProto::SearchFailedAsync(void*) -{ - Thread_SetName(MODULE ": SearchFailedThread"); - ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_FAILED, (HWND)1, 0); -} - INT_PTR CToxProto::SearchDlgProc(HWND hwnd, UINT uMsg, WPARAM, LPARAM lParam) { CToxProto *proto = (CToxProto*)GetWindowLongPtr(hwnd, GWLP_USERDATA); @@ -96,14 +90,14 @@ HWND CToxProto::OnSearchAdvanced(HWND owner) psr.id.a = mir_strdup(query.c_str()); Contact_AddBySearch(m_szModuleName, &psr, owner); - ForkThread(&CToxProto::SearchFailedAsync, nullptr); + ProtoBroadcastAsync(NULL, ACKTYPE_SEARCH, ACKRESULT_FAILED, (HANDLE)1); } else { regex = "^\\s*(([^ @/:;()\"']+)(@[A-Za-z]+.[A-Za-z]{2,6})?)\\s*$"; if (std::regex_search(query, match, regex)) ForkThread(&CToxProto::SearchByNameAsync, mir_strdup(query.c_str())); else - ForkThread(&CToxProto::SearchFailedAsync, nullptr); + ProtoBroadcastAsync(NULL, ACKTYPE_SEARCH, ACKRESULT_FAILED, (HANDLE)1); } return (HWND)1; } -- cgit v1.2.3