From: Henri Verbeet Subject: Re: [PATCH] wined3d: Avoid crash in swapchain_gl_present() if context could not be acquired. Message-Id: Date: Wed, 13 Nov 2019 20:00:23 +0330 In-Reply-To: <725e09c0-1bdc-faaa-8eef-2400934fe57c@gmail.com> References: <20191113151515.1455279-1-gofmanp@gmail.com> <725e09c0-1bdc-faaa-8eef-2400934fe57c@gmail.com> On Wed, 13 Nov 2019 at 19:38, Paul Gofman 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.