Skip to content

Commit 9455631

Browse files
author
Paul Gofman
committed
fixup! ddraw: Correctly apply state when multiple devices are used.
CW-Bug-Id: #24604
1 parent aa90bdb commit 9455631

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

dlls/ddraw/device.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -325,13 +325,12 @@ static ULONG WINAPI d3d_device_inner_Release(IUnknown *iface)
325325
if (This->recording)
326326
wined3d_stateblock_decref(This->recording);
327327

328-
if (This->ddraw->device_last_applied_state == This)
329-
This->ddraw->device_last_applied_state = NULL;
330-
331328
/* Releasing the render target below may release the last reference to the ddraw object. Detach
332329
* the device from it before so it doesn't try to save / restore state on the teared down device. */
333330
if (This->ddraw)
334331
{
332+
if (This->ddraw->device_last_applied_state == This)
333+
This->ddraw->device_last_applied_state = NULL;
335334
list_remove(&This->ddraw_entry);
336335
This->ddraw = NULL;
337336
}
@@ -3444,7 +3443,7 @@ void d3d_device_sync_surfaces(struct d3d_device *device)
34443443

34453444
static void d3d_device_apply_state(struct d3d_device *device)
34463445
{
3447-
if (device->ddraw->device_last_applied_state != device)
3446+
if (device->ddraw && device->ddraw->device_last_applied_state != device)
34483447
{
34493448
wined3d_stateblock_savedstates_set_all(device->wined3d_device, device->state);
34503449
device->ddraw->device_last_applied_state = device;

0 commit comments

Comments
 (0)