-Closing the IO register dialog no longer crashes the program anymore

This commit is contained in:
cyberwarriorx 2006-12-09 07:12:18 +00:00
parent 7ab8846882
commit 3aa8497c47
2 changed files with 13 additions and 6 deletions

View File

@ -32,7 +32,6 @@ LRESULT Ioreg_OnPaint(HWND hwnd, WPARAM wParam, LPARAM lParam)
HDC hdc;
PAINTSTRUCT ps;
TCHAR text[80];
// NDS_header * header = nds.getROMHeader();
hdc = BeginPaint(hwnd, &ps);
@ -73,7 +72,8 @@ BOOL CALLBACK IoregView_Proc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
return 1;
case WM_CLOSE :
CWindow_RemoveFromRefreshList(win);
free(win);
if (win)
free(win);
EndDialog(hwnd, 0);
return 1;
case WM_PAINT:
@ -84,7 +84,8 @@ BOOL CALLBACK IoregView_Proc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
{
case IDC_FERMER :
CWindow_RemoveFromRefreshList(win);
free(win);
if (win)
free(win);
EndDialog(hwnd, 0);
return 1;
}

View File

@ -778,10 +778,16 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
return 0;
case IDM_IOREG:
{
cwindow_struct IoregView;
cwindow_struct *IoregView;
if (CWindow_Init2(&IoregView, hAppInst, HWND_DESKTOP, "IO REG VIEW", IDD_IO_REG, IoregView_Proc) == 0)
CWindow_Show(&IoregView);
if ((IoregView = malloc(sizeof(cwindow_struct))) == NULL)
return 0;
if (CWindow_Init2(IoregView, hAppInst, HWND_DESKTOP, "IO REG VIEW", IDD_IO_REG, IoregView_Proc) == 0)
{
CWindow_AddToRefreshList(IoregView);
CWindow_Show(IoregView);
}
}
return 0;
case IDM_QUIT: