[PATCH] wined3d: Avoid crash in swapchain_gl_present() if context could not be acquired.

Henri Verbeet hverbeet at gmail.com
Wed Nov 13 10:30:23 CST 2019

On Wed, 13 Nov 2019 at 19:38, Paul Gofman <gofmanp at gmail.com> wrote:
> On 11/13/19 19:03, Henri Verbeet wrote:
> > There are certainly cases where creating a valid OpenGL context could
> > legitimately fail, but for those cases I'd either expect it to fail
> > earlier during swapchain creation, or to fallback to creating a
> > "backup window" context.
> I managed to get some more details on that. The NULL goes from
> wined3d_context_gl_acquire(), "Rendering onscreen" case.
> wined3d_context_gl_init() fails with 'Failed to set pixel format 27...'.
> This most likely happens because window is already destroyed. This
> window and device is likely not going to be used anymore, it only needs
> to survive the destruction without crashing the application.
If the window is already destroyed, I'd expect the earlier GetDCEx()
call to fail, in which case wined3d_context_gl_init() would try to
create a backup context. We could potentially handle
wined3d_context_gl_set_pixel_format() failures in the same way, but it
would be good to know why that's happening first.

More information about the wine-devel mailing list