[PATCH] dxgi: Avoid a double free in d3d11_swapchain_init().
Henri Verbeet
hverbeet at gmail.com
Tue Feb 18 09:31:40 CST 2020
On Tue, 18 Feb 2020 at 05:57, Zhiyi Zhang <zzhang at codeweavers.com> wrote:
> +void CDECL wined3d_device_destroy_swapchain(struct wined3d_device *device, struct wined3d_swapchain *swapchain)
> +{
> + if (device->swapchain_count && device->swapchains[0] == swapchain)
> + wined3d_device_uninit_3d(device);
> +
> + wined3d_cs_finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
> + device->adapter->adapter_ops->adapter_destroy_swapchain(swapchain);
> +}
> +
I think the introduction of wined3d_device_destroy_swapchain in the
public wined3d API is undesirable, but even more undesirable is the
fact that it does something different from destroying the swapchain
through wined3d_swapchain_decref().
I think you should simply avoid the issue by moving the code for
handling fullscreen mode in d3d11_swapchain_init() to
dxgi_swapchain_factory_create_swapchain(). If that were somehow not
possible you could check whether parent initialisation is completely
done in d3d11_swapchain_wined3d_object_released(), but I don't think
that's the case.
More information about the wine-devel
mailing list