From 8723007872879b769757fa17ea350a352cd58e27 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 1 Mar 2022 11:59:11 +0300 Subject: fixes #2976 (Omegle: Miranda crash when using Omegle) --- protocols/Omegle/src/communication.cpp | 25 +++---------------------- protocols/Omegle/src/connection.cpp | 11 +++++++---- protocols/Omegle/src/version.h | 2 +- 3 files changed, 11 insertions(+), 27 deletions(-) (limited to 'protocols/Omegle/src') diff --git a/protocols/Omegle/src/communication.cpp b/protocols/Omegle/src/communication.cpp index e5e0f6a689..f033cd93a6 100644 --- a/protocols/Omegle/src/communication.cpp +++ b/protocols/Omegle/src/communication.cpp @@ -425,29 +425,10 @@ bool Omegle_client::stop() http::response resp = flap(OMEGLE_REQUEST_STOP, &data); - if (hConnection) - Netlib_CloseHandle(hConnection); - hConnection = nullptr; + Netlib_Shutdown(hConnection); + Netlib_Shutdown(hEventsConnection); - if (hEventsConnection) - Netlib_CloseHandle(hEventsConnection); - hEventsConnection = nullptr; - - if (resp.data == "win") { - return HANDLE_SUCCESS; - } - else { - return HANDLE_ERROR(false); - } - - /* switch ( resp.code ) - { - case HTTP_CODE_OK: - case HTTP_CODE_FOUND: - - default: - - }*/ + return (resp.data == "win") ? HANDLE_SUCCESS : HANDLE_ERROR(false); } bool Omegle_client::events() diff --git a/protocols/Omegle/src/connection.cpp b/protocols/Omegle/src/connection.cpp index c75f12c584..7750fe9038 100644 --- a/protocols/Omegle/src/connection.cpp +++ b/protocols/Omegle/src/connection.cpp @@ -56,10 +56,6 @@ void OmegleProto::SignOff(void*) delSetting("LogonTS"); ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus); - - if (facy.hEventsConnection) - Netlib_CloseHandle(facy.hEventsConnection); - facy.hEventsConnection = nullptr; } void OmegleProto::StopChat(bool disconnect) @@ -165,5 +161,12 @@ void OmegleProto::EventsLoop(void *) } ResetEvent(events_loop_lock_); + + Netlib_CloseHandle(facy.hConnection); + facy.hConnection = nullptr; + + Netlib_CloseHandle(facy.hEventsConnection); + facy.hEventsConnection = nullptr; + debugLogA("<<<<< Exiting OmegleProto::EventsLoop[%d]", tim); } diff --git a/protocols/Omegle/src/version.h b/protocols/Omegle/src/version.h index 87daaf17c1..b0d8196bd2 100644 --- a/protocols/Omegle/src/version.h +++ b/protocols/Omegle/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 1 #define __RELEASE_NUM 3 -#define __BUILD_NUM 3 +#define __BUILD_NUM 4 #include -- cgit v1.2.3