aboutsummaryrefslogtreecommitdiff
path: root/windows.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2005-09-10 08:31:22 +0000
committerSimon Tatham <anakin@pobox.com>2005-09-10 08:31:22 +0000
commit72989cdf1d73b371fec933e905c5482d709ec6bb (patch)
tree2a208d8e0a5c065c2f4019eb366002436156bd42 /windows.c
parentf8d1183c7a385d6c81479a5ed4a61cbf6e77e2e8 (diff)
downloadpuzzles-72989cdf1d73b371fec933e905c5482d709ec6bb.zip
puzzles-72989cdf1d73b371fec933e905c5482d709ec6bb.tar.gz
puzzles-72989cdf1d73b371fec933e905c5482d709ec6bb.tar.bz2
puzzles-72989cdf1d73b371fec933e905c5482d709ec6bb.tar.xz
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]
Diffstat (limited to 'windows.c')
-rw-r--r--windows.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/windows.c b/windows.c
index 72d0120..6b90023 100644
--- a/windows.c
+++ b/windows.c
@@ -1091,7 +1091,6 @@ static frontend *new_window(HINSTANCE inst, char *game_id, char **error)
frontend *fe;
int x, y;
RECT r;
- HDC hdc;
fe = snew(frontend);
@@ -1150,7 +1149,8 @@ static frontend *new_window(HINSTANCE inst, char *game_id, char **error)
WS_CHILD | WS_VISIBLE,
0, 0, 0, 0, /* status bar does these */
NULL, NULL, inst, NULL);
- }
+ } else
+ fe->statusbar = NULL;
get_max_puzzle_size(fe, &x, &y);
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);
}
- new_game_size(fe);
+ fe->bitmap = NULL;
+ new_game_size(fe); /* initialises fe->bitmap */
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);
ShowWindow(fe->hwnd, SW_NORMAL);
@@ -1906,7 +1903,7 @@ static void new_game_size(frontend *fe)
SetWindowPos(fe->statusbar, NULL, 0, y, x,
sr.bottom - sr.top, SWP_NOZORDER);
- DeleteObject(fe->bitmap);
+ if (fe->bitmap) DeleteObject(fe->bitmap);
hdc = GetDC(fe->hwnd);
fe->bitmap = CreateCompatibleBitmap(hdc, x, y);