mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 16:05:44 -07:00
Patch from James H which initialises a couple of Windows API object
handles to NULL before accidentally trying to use them for anything. [originally from svn r6282]
This commit is contained in:
13
windows.c
13
windows.c
@ -1091,7 +1091,6 @@ static frontend *new_window(HINSTANCE inst, char *game_id, char **error)
|
|||||||
frontend *fe;
|
frontend *fe;
|
||||||
int x, y;
|
int x, y;
|
||||||
RECT r;
|
RECT r;
|
||||||
HDC hdc;
|
|
||||||
|
|
||||||
fe = snew(frontend);
|
fe = snew(frontend);
|
||||||
|
|
||||||
@ -1150,7 +1149,8 @@ static frontend *new_window(HINSTANCE inst, char *game_id, char **error)
|
|||||||
WS_CHILD | WS_VISIBLE,
|
WS_CHILD | WS_VISIBLE,
|
||||||
0, 0, 0, 0, /* status bar does these */
|
0, 0, 0, 0, /* status bar does these */
|
||||||
NULL, NULL, inst, NULL);
|
NULL, NULL, inst, NULL);
|
||||||
}
|
} else
|
||||||
|
fe->statusbar = NULL;
|
||||||
|
|
||||||
get_max_puzzle_size(fe, &x, &y);
|
get_max_puzzle_size(fe, &x, &y);
|
||||||
midend_size(fe->me, &x, &y, FALSE);
|
midend_size(fe->me, &x, &y, FALSE);
|
||||||
@ -1261,13 +1261,10 @@ static frontend *new_window(HINSTANCE inst, char *game_id, char **error)
|
|||||||
SetMenu(fe->hwnd, bar);
|
SetMenu(fe->hwnd, bar);
|
||||||
}
|
}
|
||||||
|
|
||||||
new_game_size(fe);
|
fe->bitmap = NULL;
|
||||||
|
new_game_size(fe); /* initialises fe->bitmap */
|
||||||
check_window_size(fe, &x, &y);
|
check_window_size(fe, &x, &y);
|
||||||
|
|
||||||
hdc = GetDC(fe->hwnd);
|
|
||||||
fe->bitmap = CreateCompatibleBitmap(hdc, x, y);
|
|
||||||
ReleaseDC(fe->hwnd, hdc);
|
|
||||||
|
|
||||||
SetWindowLong(fe->hwnd, GWL_USERDATA, (LONG)fe);
|
SetWindowLong(fe->hwnd, GWL_USERDATA, (LONG)fe);
|
||||||
|
|
||||||
ShowWindow(fe->hwnd, SW_NORMAL);
|
ShowWindow(fe->hwnd, SW_NORMAL);
|
||||||
@ -1906,7 +1903,7 @@ static void new_game_size(frontend *fe)
|
|||||||
SetWindowPos(fe->statusbar, NULL, 0, y, x,
|
SetWindowPos(fe->statusbar, NULL, 0, y, x,
|
||||||
sr.bottom - sr.top, SWP_NOZORDER);
|
sr.bottom - sr.top, SWP_NOZORDER);
|
||||||
|
|
||||||
DeleteObject(fe->bitmap);
|
if (fe->bitmap) DeleteObject(fe->bitmap);
|
||||||
|
|
||||||
hdc = GetDC(fe->hwnd);
|
hdc = GetDC(fe->hwnd);
|
||||||
fe->bitmap = CreateCompatibleBitmap(hdc, x, y);
|
fe->bitmap = CreateCompatibleBitmap(hdc, x, y);
|
||||||
|
Reference in New Issue
Block a user