diff options
author | aunsane <aunsane@gmail.com> | 2018-01-17 21:46:01 +0300 |
---|---|---|
committer | aunsane <aunsane@gmail.com> | 2018-01-17 21:46:01 +0300 |
commit | 5f96f1919d2d8210c4a67fe5a4fd9c0f84f9ee27 (patch) | |
tree | 34ac365339b2504f7a2bc8e728fb379b88962a28 | |
parent | 8e7d34b4716392f9d9a338e755027cff0a8f3161 (diff) |
Tox: attempt to fix crash on startup #1105
-rw-r--r-- | protocols/Tox/src/stdafx.h | 6 | ||||
-rw-r--r-- | protocols/Tox/src/tox_connection.cpp | 9 |
2 files changed, 9 insertions, 6 deletions
diff --git a/protocols/Tox/src/stdafx.h b/protocols/Tox/src/stdafx.h index 367108e1ad..5e4af6b0c9 100644 --- a/protocols/Tox/src/stdafx.h +++ b/protocols/Tox/src/stdafx.h @@ -59,12 +59,10 @@ extern HINSTANCE g_hInstance; #define MODULE "Tox"
-#define TOX_API_VER_MAJOR 0
-#define TOX_API_VER_MINOR 1
-#define TOX_API_VER_PATCH 5
-
#define TOX_ERROR -1
+#define TOX_DEFAULT_INTERVAL 50
+
#define TOX_MAX_CONNECT_RETRIES 10
#define TOX_MAX_RECONNECT_RETRIES 10
diff --git a/protocols/Tox/src/tox_connection.cpp b/protocols/Tox/src/tox_connection.cpp index f846866242..392f7bbbb6 100644 --- a/protocols/Tox/src/tox_connection.cpp +++ b/protocols/Tox/src/tox_connection.cpp @@ -109,11 +109,16 @@ void CToxProto::PollingThread(void*) while (!isTerminated) { tox_iterate(toxThread.Tox(), this); uint32_t interval = tox_iteration_interval(toxThread.Tox()); - interval = interval ? interval : 50; - + interval = interval + ? interval + : TOX_DEFAULT_INTERVAL; WaitForSingleObject(hTerminateEvent, interval); } + SetEvent(hTerminateEvent); + + Sleep(TOX_DEFAULT_INTERVAL * 10); + UninitToxCore(toxThread.Tox()); m_toxThread = nullptr; hPollingThread = nullptr; |