ref: 72989cdf1d73b371fec933e905c5482d709ec6bb
parent: f8d1183c7a385d6c81479a5ed4a61cbf6e77e2e8
author: Simon Tatham <anakin@pobox.com>
date: Sat Sep 10 04:31:22 EDT 2005
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]
--- a/windows.c
+++ b/windows.c
@@ -1091,7 +1091,6 @@
frontend *fe;
int x, y;
RECT r;
- HDC hdc;
fe = snew(frontend);
@@ -1150,7 +1149,8 @@
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 @@
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 @@
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);