From 9e8da84fff2f4e11bb9182bbd1b727e525ff0d30 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Mon, 29 Sep 2014 18:51:27 +0000 Subject: Tox: fixed crash on closing tox profile import window git-svn-id: http://svn.miranda-ng.org/main/trunk@10635 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Tox/res/resource.rc | 2 +- protocols/Tox/src/tox_profile.cpp | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/protocols/Tox/res/resource.rc b/protocols/Tox/res/resource.rc index 12df8301a4..3d4c63a511 100644 --- a/protocols/Tox/res/resource.rc +++ b/protocols/Tox/res/resource.rc @@ -123,7 +123,7 @@ CAPTION "Tox profile import" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN PUSHBUTTON "Import",IDOK,124,66,50,14,WS_DISABLED - LTEXT "Tox profile contains your ID and friend list.\r\nYou may import existing profile from other tox client.\r\nPress "Import" to perform import from existing profile.\r\nPress "Cancel" or close this window to create new profile.",IDC_STATIC,7,7,221,31 + LTEXT "Tox profile contains your ID and friend list.\r\nYou may import existing profile from other tox client.\r\nPress ""Import"" to perform import from existing profile.\r\nPress ""Cancel"" or close this window to create new profile.",IDC_STATIC,7,7,221,31 EDITTEXT IDC_PROFILE_PATH,7,38,202,14,ES_AUTOHSCROLL PUSHBUTTON "...",IDC_BROWSE_PROFILE,212,38,16,14 DEFPUSHBUTTON "Cancel",IDCANCEL,178,66,50,14 diff --git a/protocols/Tox/src/tox_profile.cpp b/protocols/Tox/src/tox_profile.cpp index 168e998d8c..1ad015dee3 100644 --- a/protocols/Tox/src/tox_profile.cpp +++ b/protocols/Tox/src/tox_profile.cpp @@ -124,7 +124,11 @@ INT_PTR CToxProto::ToxProfileManagerProc(HWND hwnd, UINT uMsg, WPARAM wParam, LP return TRUE; case WM_CLOSE: - EndDialog(hwnd, 0); + { + std::tstring defaultProfilePath = proto->GetToxProfilePath(); + fclose(_wfopen(defaultProfilePath.c_str(), _T("w"))); + EndDialog(hwnd, 0); + } break; case WM_DESTROY: @@ -134,6 +138,14 @@ INT_PTR CToxProto::ToxProfileManagerProc(HWND hwnd, UINT uMsg, WPARAM wParam, LP case WM_COMMAND: switch (LOWORD(wParam)) { + case IDC_PROFILE_PATH: + if ((HWND)lParam == GetFocus()) + { + if (HIWORD(wParam) != EN_CHANGE) return 0; + EnableWindow(GetDlgItem(hwnd, IDOK), TRUE); + } + break; + case IDC_BROWSE_PROFILE: { TCHAR filter[MAX_PATH] = { 0 }; -- cgit v1.2.3