diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2015-09-10 11:58:58 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2015-09-10 11:58:58 +0000 |
commit | 510f938a5c6f0ee95ac0b36e56aced065228298e (patch) | |
tree | 19f907a09498b6f76a4b7aae6ee90a16bf693aa2 /protocols/Tox/src/tox_options.cpp | |
parent | 86c868a76a5ba3d638b3b7302cd5401df06591d8 (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_options.cpp')
-rw-r--r-- | protocols/Tox/src/tox_options.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/protocols/Tox/src/tox_options.cpp b/protocols/Tox/src/tox_options.cpp index 87b9df8ce3..ddebf72d92 100644 --- a/protocols/Tox/src/tox_options.cpp +++ b/protocols/Tox/src/tox_options.cpp @@ -62,6 +62,8 @@ void CToxOptionsMain::ToxAddressCopy_OnClick(CCtrlButton*) void CToxOptionsMain::ProfileCreate_OnClick(CCtrlButton*)
{
+ ToxThreadData toxThread;
+
std::tstring profilePath = m_proto->GetToxProfilePath();
if (!m_proto->IsFileExists(profilePath))
{
@@ -74,7 +76,7 @@ void CToxOptionsMain::ProfileCreate_OnClick(CCtrlButton*) CloseHandle(hProfile);
TOX_ERR_NEW initError;
- m_proto->tox = tox_new(NULL, &initError);
+ toxThread.tox = tox_new(NULL, &initError);
if (initError != TOX_ERR_NEW_OK)
{
m_proto->debugLogA(__FUNCTION__": failed to load tox profile (%d)", initError);
@@ -82,14 +84,14 @@ void CToxOptionsMain::ProfileCreate_OnClick(CCtrlButton*) }
}
- if (m_proto->InitToxCore())
+ if (m_proto->InitToxCore(&toxThread))
{
TCHAR *group = m_group.GetText();
if (mir_tstrlen(group) > 0 && Clist_GroupExists(group))
Clist_CreateGroup(0, group);
m_proto->LoadFriendList(NULL);
- m_proto->UninitToxCore();
+ m_proto->UninitToxCore(&toxThread);
m_toxAddress.Enable();
m_toxAddress.SetTextA(ptrA(m_proto->getStringA(TOX_SETTINGS_ID)));
@@ -175,9 +177,8 @@ void CToxOptionsMain::OnApply() {
CallProtoService(m_proto->m_szModuleName, PS_SETMYNICKNAME, SMNN_TCHAR, (LPARAM)ptrT(m_nickname.GetText()));
- if (m_proto->password != NULL)
- mir_free(m_proto->password);
- m_proto->password = mir_utf8encodeW(ptrT(m_password.GetText()));
+ // todo: add checkbox
+ m_proto->setTString("Password", pass_ptrT(m_password.GetText()));
m_proto->SaveToxProfile();
}
|