summaryrefslogtreecommitdiff
path: root/protocols/Tox/src/tox_proto.h
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-09-10 11:58:58 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-09-10 11:58:58 +0000
commit510f938a5c6f0ee95ac0b36e56aced065228298e (patch)
tree19f907a09498b6f76a4b7aae6ee90a16bf693aa2 /protocols/Tox/src/tox_proto.h
parent86c868a76a5ba3d638b3b7302cd5401df06591d8 (diff)
Tox: tox pointers should store in PollingThread to avoid cross thread using
git-svn-id: http://svn.miranda-ng.org/main/trunk@15316 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox/src/tox_proto.h')
-rw-r--r--protocols/Tox/src/tox_proto.h26
1 files changed, 17 insertions, 9 deletions
diff --git a/protocols/Tox/src/tox_proto.h b/protocols/Tox/src/tox_proto.h
index cb33550aa0..9b8b2e171c 100644
--- a/protocols/Tox/src/tox_proto.h
+++ b/protocols/Tox/src/tox_proto.h
@@ -1,6 +1,19 @@
#ifndef _TOX_PROTO_H_
#define _TOX_PROTO_H_
+struct ToxThreadData
+{
+ Tox *tox;
+ ToxAv *toxAv;
+ bool isConnected;
+ bool isTerminated;
+
+ mir_cs toxLock;
+
+ ToxThreadData() : tox(NULL), toxAv(NULL),
+ isConnected(false), isTerminated(false) { }
+};
+
struct CToxProto : public PROTO<CToxProto>
{
friend CToxPasswordEditor;
@@ -69,14 +82,10 @@ public:
static int OnModulesLoaded(WPARAM, LPARAM);
private:
- Tox *tox;
- ToxAv *toxAv;
- char *password;
- mir_cs toxLock;
+ ToxThreadData *toxThread;
mir_cs profileLock;
TCHAR *accountName;
HANDLE hNetlib, hPollingThread;
- bool isTerminated, isConnected;
CTransferList transfers;
static HANDLE hProfileFolderPath;
@@ -91,8 +100,9 @@ private:
INT_PTR __cdecl OnCopyToxID(WPARAM, LPARAM);
// tox core
- bool InitToxCore();
- void UninitToxCore();
+ Tox_Options* GetToxOptions();
+ bool InitToxCore(ToxThreadData *toxThread);
+ void UninitToxCore(ToxThreadData *toxThread);
// tox network
bool IsOnline();
@@ -103,7 +113,6 @@ private:
void BootstrapNodes();
void TryConnect();
void CheckConnection(int &retriesCount);
- void DoTox();
void __cdecl PollingThread(void*);
@@ -224,7 +233,6 @@ private:
int __cdecl OnPreCreateMessage(WPARAM wParam, LPARAM lParam);
// transfer
-
HANDLE OnFileAllow(MCONTACT hContact, HANDLE hTransfer, const TCHAR *tszPath);
int OnFileResume(HANDLE hTransfer, int *action, const TCHAR **szFilename);
int OnFileCancel(MCONTACT hContact, HANDLE hTransfer);