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

Paul Gofman gofmanp at gmail.com
Wed Nov 13 09:46:01 CST 2019

On 11/13/19 18:35, Henri Verbeet wrote:
> On Wed, 13 Nov 2019 at 18:45, Paul Gofman <gofmanp at gmail.com> wrote:
>> @@ -453,7 +453,12 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain,
>>      struct wined3d_context *context;
>>      BOOL render_to_fbo;
>> -    context = context_acquire(swapchain->device, swapchain->front_buffer, 0);
>> +    if (!(context = context_acquire(swapchain->device, swapchain->front_buffer, 0)))
>> +    {
>> +        WARN("Could not get context, skipping present.\n");
>> +        return;
>> +    }
> Can this legitimately happen?

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.

More information about the wine-devel mailing list