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

Paul Gofman gofmanp at gmail.com
Wed Nov 13 10:08:29 CST 2019

On 11/13/19 19:03, Henri Verbeet wrote:
> On Wed, 13 Nov 2019 at 19:16, Paul Gofman <gofmanp at gmail.com> wrote:
>> That what happens with AION game, upon transition from login screen to
>> 3D scene display. I did not unwind the sequence which leads to that,
>> there is quite the time to pass loading to that point, and then it uses
>> some mixture of d3d9 and d3d11 elements rendered to the same main
>> window. Adding this check fixes the crash and it renders everything
>> flawlessly after that. Somehow I though a lot of things can go wrong
>> during acquiring or creating a new context for the thread, especially
>> when the app is recreating Windows and devices. If nothing of that is
>> supposed, I can try to detect what exactly is going on there, but that's
>> going to take some time.
> 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.

More information about the wine-devel mailing list