Commit 62fa286e authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

wined3d: Clean up swapchain state on wined3d_swapchain_init() failure paths.

parent 2697b74d
......@@ -34,7 +34,7 @@ void wined3d_swapchain_cleanup(struct wined3d_swapchain *swapchain)
TRACE("Destroying swapchain %p.\n", swapchain);
wined3d_swapchain_state_unregister(&swapchain->state);
wined3d_swapchain_state_cleanup(&swapchain->state);
wined3d_swapchain_set_gamma_ramp(swapchain, 0, &swapchain->orig_gamma);
/* Release the swapchain's draw buffers. Make sure swapchain->back_buffers[0]
......@@ -1359,7 +1359,8 @@ static HRESULT wined3d_swapchain_init(struct wined3d_swapchain *swapchain, struc
if (FAILED(hr = wined3d_swapchain_state_init(&swapchain->state, desc, window, device->wined3d, state_parent)))
{
ERR("Failed to initialise swapchain state, hr %#x.\n", hr);
goto err;
wined3d_mutex_unlock();
return hr;
}
swapchain->swapchain_ops = swapchain_ops;
......@@ -1565,6 +1566,7 @@ err:
wined3d_texture_decref(swapchain->front_buffer);
}
wined3d_swapchain_state_cleanup(&swapchain->state);
wined3d_mutex_unlock();
return hr;
......@@ -2290,7 +2292,7 @@ BOOL CDECL wined3d_swapchain_state_is_windowed(const struct wined3d_swapchain_st
void CDECL wined3d_swapchain_state_destroy(struct wined3d_swapchain_state *state)
{
wined3d_swapchain_state_unregister(state);
wined3d_swapchain_state_cleanup(state);
heap_free(state);
}
......
......@@ -817,7 +817,7 @@ void wined3d_swapchain_state_register(struct wined3d_swapchain_state *state,
wined3d_wndproc_mutex_unlock();
}
void wined3d_swapchain_state_unregister(struct wined3d_swapchain_state *state)
static void wined3d_swapchain_state_unregister(struct wined3d_swapchain_state *state)
{
struct wined3d_registered_swapchain_state *state_entry, *last_state_entry;
struct wined3d_window_hook *hook, *last_hook;
......@@ -850,6 +850,11 @@ void wined3d_swapchain_state_unregister(struct wined3d_swapchain_state *state)
wined3d_wndproc_mutex_unlock();
}
void wined3d_swapchain_state_cleanup(struct wined3d_swapchain_state *state)
{
wined3d_swapchain_state_unregister(state);
}
/* At process attach */
BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, void *reserved)
{
......
......@@ -5083,13 +5083,13 @@ struct wined3d_swapchain_state
HWND device_window;
};
void wined3d_swapchain_state_cleanup(struct wined3d_swapchain_state *state) DECLSPEC_HIDDEN;
void wined3d_swapchain_state_register(struct wined3d_swapchain_state *state,
struct wined3d *wined3d) DECLSPEC_HIDDEN;
void wined3d_swapchain_state_restore_from_fullscreen(struct wined3d_swapchain_state *state,
HWND window, const RECT *window_rect) DECLSPEC_HIDDEN;
HRESULT wined3d_swapchain_state_setup_fullscreen(struct wined3d_swapchain_state *state,
HWND window, int x, int y, int width, int height) DECLSPEC_HIDDEN;
void wined3d_swapchain_state_unregister(struct wined3d_swapchain_state *state) DECLSPEC_HIDDEN;
struct wined3d_swapchain_ops
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment