From 4e840a6995702120d27e7122089b46bb3a370f19 Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Thu, 17 Oct 2013 20:42:03 +0100 Subject: [PATCH] [loc] fix a crash on exit * Don't free loc_filename if it points to embedded name * Also fix resizing of main dialog --- src/localization.c | 5 ++++- src/rufus.rc | 10 +++++----- src/stdlg.c | 6 +++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/localization.c b/src/localization.c index 610b6351..9c8c5e34 100644 --- a/src/localization.c +++ b/src/localization.c @@ -131,7 +131,8 @@ void init_localization(void) { void exit_localization(void) { free_dialog_list(); free_locale_list(); - safe_free(loc_filename); + if (loc_filename != embedded_loc_filename) + safe_free(loc_filename); } /* @@ -240,6 +241,8 @@ void apply_localization(int dlg_id, HWND hDlg) continue; } hCtrl = hDlg; + if (dlg_id == IDD_DIALOG) + hDlg = NULL; } else { hCtrl = GetDlgItem(hDlg, lcmd->ctrl_id); } diff --git a/src/rufus.rc b/src/rufus.rc index 36d8c70f..1e965599 100644 --- a/src/rufus.rc +++ b/src/rufus.rc @@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL IDD_DIALOG DIALOGEX 12, 12, 206, 329 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_APPWINDOW -CAPTION "Rufus v1.4.0.284" +CAPTION "Rufus v1.4.0.285" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN DEFPUSHBUTTON "Start",IDC_START,94,291,50,14 @@ -284,8 +284,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,4,0,284 - PRODUCTVERSION 1,4,0,284 + FILEVERSION 1,4,0,285 + PRODUCTVERSION 1,4,0,285 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -302,13 +302,13 @@ BEGIN BEGIN VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "1.4.0.284" + VALUE "FileVersion", "1.4.0.285" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "© 2011-2013 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" VALUE "OriginalFilename", "rufus.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "1.4.0.284" + VALUE "ProductVersion", "1.4.0.285" END END BLOCK "VarFileInfo" diff --git a/src/stdlg.c b/src/stdlg.c index 58a26e86..c21ab445 100644 --- a/src/stdlg.c +++ b/src/stdlg.c @@ -466,12 +466,12 @@ void ResizeMoveCtrl(HWND hDlg, HWND hCtrl, int dx, int dy, int dw, int dh) GetWindowRect(hCtrl, &rect); point.x = rect.left; point.y = rect.top; - ScreenToClient((hDlg==hMainDialog)?hDlg:NULL, &point); + ScreenToClient(hDlg, &point); GetClientRect(hCtrl, &rect); // If we're dealing with a dialog, we must take the border into account - if (hCtrl == hDlg) - border = GetBorderSize(hDlg); + if ((hCtrl == hDlg) || (hDlg == NULL)) + border = GetBorderSize(hCtrl); MoveWindow(hCtrl, point.x + (int)(fScale*(float)dx), point.y + (int)(fScale*(float)dy), (rect.right - rect.left) + (int)(fScale*(float)dw + border.cx), (rect.bottom - rect.top) + border.cy, TRUE);