wined3d: Avoid accessing the device after deactivation some more.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2018-10-16 20:46:11 +03:30 committed by Alexandre Julliard
parent 4cabe3612f
commit a4104c7c60
1 changed files with 6 additions and 2 deletions

View File

@ -5315,9 +5315,13 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
} }
else if (message == WM_ACTIVATEAPP) else if (message == WM_ACTIVATEAPP)
{ {
UINT i; unsigned int i = device->swapchain_count;
for (i = 0; i < device->swapchain_count; i++) /* Deactivating the implicit swapchain may cause the application
* (e.g. Deus Ex: GOTY) to destroy the device, so take care to
* deactivate the implicit swapchain last, and to avoid accessing the
* "device" pointer afterwards. */
while (i--)
wined3d_swapchain_activate(device->swapchains[i], wparam); wined3d_swapchain_activate(device->swapchains[i], wparam);
} }
else if (message == WM_SYSCOMMAND) else if (message == WM_SYSCOMMAND)