summaryrefslogtreecommitdiff
path: root/src/video
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-08-09 05:25:33 +0000
committerrubidium <rubidium@openttd.org>2007-08-09 05:25:33 +0000
commit2bff32afb078791d8d4cf238ccd2c1136fae84bb (patch)
treefc3560bf58f5437dd4726b79260ea12e717424fb /src/video
parentc4a30877238d15bd8e3c5d794449e372dc787bcb (diff)
downloadopenttd-2bff32afb078791d8d4cf238ccd2c1136fae84bb.tar.xz
(svn r10833) -Fix [FS#1115]: assertion (different cost between test and execution) of overbuilding road tunnels with tram tracks (and vice versa) when the dragged area contains both ends of the tunnel.
Diffstat (limited to 'src/video')
-rw-r--r--src/video/win32_v.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/video/win32_v.cpp b/src/video/win32_v.cpp
index 02ad4a2d4..65937fa9e 100644
--- a/src/video/win32_v.cpp
+++ b/src/video/win32_v.cpp
@@ -219,8 +219,9 @@ static void MakeWindow(bool full_screen)
// recreate window?
if ((full_screen || _wnd.fullscreen) && _wnd.main_wnd) {
- DestroyWindow(_wnd.main_wnd);
+ HWND wnd = _wnd.main_wnd;
_wnd.main_wnd = 0;
+ DestroyWindow(wnd);
}
#if defined(WINCE)
@@ -519,6 +520,9 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
break;
case WM_SIZE:
+ /* Resizing a destroy window is NOT good */
+ if (_wnd.main_wnd == 0) return;
+
if (wParam != SIZE_MINIMIZED) {
/* Set maximized flag when we maximize (obviously), but also when we
* switched to fullscreen from a maximized state */
@@ -792,7 +796,9 @@ void VideoDriver_Win32::Stop()
{
DeleteObject(_wnd.gdi_palette);
DeleteObject(_wnd.dib_sect);
- DestroyWindow(_wnd.main_wnd);
+ HWND wnd = _wnd.main_wnd;
+ _wnd.main_wnd = 0;
+ DestroyWindow(wnd);
#if !defined(WINCE)
if (_wnd.fullscreen) ChangeDisplaySettings(NULL, 0);