Recompiling caussed memory leaks - fixed

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@950 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2002-09-06 22:18:47 +00:00
parent 18c5a5f1b8
commit 0818ec631c
2 changed files with 11 additions and 9 deletions

View file

@ -75,8 +75,6 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
case WM_INITDIALOG:
{
g_hwnd=hwndDlg;
g_output_exe = (char *)GlobalAlloc(GPTR, 1);
g_input_script = (char *)GlobalAlloc(GPTR, 1);
HICON hIcon = LoadIcon(g_hInstance,MAKEINTRESOURCE(IDI_ICON));
SetClassLong(hwndDlg,GCL_HICON,(long)hIcon);
HFONT hFont = CreateFont(14,0,0,0,FW_NORMAL,0,0,0,DEFAULT_CHARSET,OUT_CHARACTER_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,FIXED_PITCH|FF_DONTCARE,"Courier New");
@ -179,14 +177,14 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
case IDM_TEST:
case IDC_TEST:
{
if (g_output_exe[0]) {
if (g_output_exe) {
ShellExecute(g_hwnd,"open",g_output_exe,NULL,NULL,SW_SHOWNORMAL);
}
return TRUE;
}
case IDM_EDITSCRIPT:
{
if (g_input_script[0]) {
if (g_input_script) {
if ((int)ShellExecute(g_hwnd,"open",g_input_script,NULL,NULL,SW_SHOWNORMAL)<=32) {
char path[MAX_PATH];
if (GetWindowsDirectory(path,sizeof(path))) {

View file

@ -71,8 +71,6 @@ void ErrorMessage(HWND hwnd,const char *str) {
}
void DisableItems(HWND hwnd) {
g_output_exe[0]=0;
g_input_script[0]=0;
EnableWindow(GetDlgItem(hwnd,IDC_CLOSE),0);
EnableWindow(GetDlgItem(hwnd,IDC_TEST),0);
HMENU m = GetMenu(hwnd);
@ -90,8 +88,14 @@ void EnableItems(HWND hwnd) {
#define MSG1(a,b) SendDlgItemMessage(hwnd,IDC_LOGWIN,a,b,0)
#define MSG2(a,b,c) SendDlgItemMessage(hwnd,IDC_LOGWIN,a,b,c)
if (g_input_script) GlobalFree(g_input_script);
if (g_output_exe) GlobalFree(g_output_exe);
if (g_input_script) {
GlobalFree(g_input_script);
g_input_script = 0;
}
if (g_output_exe) {
GlobalFree(g_output_exe);
g_output_exe = 0;
}
TEXTRANGE tr;
FINDTEXT ft;
@ -124,7 +128,7 @@ void EnableItems(HWND hwnd) {
if (MSG2(EM_FINDTEXT, 0, (LPARAM)&ft) != -1) g_warnings++;
HMENU m = GetMenu(hwnd);
if (g_output_exe[0]) {
if (g_output_exe) {
EnableWindow(GetDlgItem(hwnd,IDC_TEST),1);
EnableMenuItem(m,IDM_TEST,MF_ENABLED);
}