From 510f938a5c6f0ee95ac0b36e56aced065228298e Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Thu, 10 Sep 2015 11:58:58 +0000 Subject: 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 --- protocols/Tox/src/tox_options.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'protocols/Tox/src/tox_options.cpp') 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(); } -- cgit v1.2.3