Henri Verbeet : wined3d: Avoid accessing the device after deactivation some more.

Alexandre Julliard julliard at winehq.org
Tue Oct 16 15:53:07 CDT 2018


Module: wine
Branch: master
Commit: a4104c7c6085e42a97594eafb8726acfc82e1230
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=a4104c7c6085e42a97594eafb8726acfc82e1230

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Tue Oct 16 21:04:11 2018 +0330

wined3d: Avoid accessing the device after deactivation some more.

Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/device.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 70d43e0..b90df20 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -5315,9 +5315,13 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
     }
     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);
     }
     else if (message == WM_SYSCOMMAND)




More information about the wine-cvs mailing list