- properly allocate size in AddScriptCmdArgs

- do clean-up in WM_DESTROY, not only WM_CLOSE


git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@5098 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2007-04-17 20:41:17 +00:00
parent f91406647a
commit 7d1f948631

View file

@ -101,7 +101,7 @@ void SetScript(const char *script, bool clearArgs /*= true*/)
void AddScriptCmdArgs(const char *arg)
{
g_sdata.script_cmd_args = (char *) GlobalReAlloc(g_sdata.script_cmd_args,
GlobalSize(g_sdata.script_cmd_args) + 2 /* quotes */ + 1 /* space */,
GlobalSize(g_sdata.script_cmd_args) + lstrlen(arg) + 2 /* quotes */ + 1 /* space */,
0);
lstrcat(g_sdata.script_cmd_args, " \"");
@ -217,23 +217,23 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
}
case WM_DESTROY:
{
DragAcceptFiles(g_sdata.hwnd,FALSE);
SaveSymbols();
SaveCompressor();
SaveMRUList();
SaveWindowPos(g_sdata.hwnd);
ImageList_Destroy(g_toolbar.imagelist);
ImageList_Destroy(g_toolbar.imagelistd);
ImageList_Destroy(g_toolbar.imagelisth);
DestroyTooltips();
FreeLibrary(hRichEditDLL);
PostQuitMessage(0);
return TRUE;
}
case WM_CLOSE:
{
if (!g_sdata.thread) {
DragAcceptFiles(g_sdata.hwnd,FALSE);
ImageList_Destroy(g_toolbar.imagelist);
ImageList_Destroy(g_toolbar.imagelistd);
ImageList_Destroy(g_toolbar.imagelisth);
DestroyWindow(hwndDlg);
FreeLibrary(hRichEditDLL);
}
return TRUE;
}