From b0234f390c170fd6604be6ca50a13a5597900662 Mon Sep 17 00:00:00 2001 From: Kirill Burtsev Date: Thu, 9 Apr 2020 13:06:01 +0200 Subject: Fix crash on fence create after failure to make context current MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GLFence::Create requires valid current gl context, which is not the case if InProcCommandBuffer::MakeCurrent fails: driver and api structures will be null after context loss (for examples on os resume with desktop gl), that triggers access violation. Fixes: QTBUG-82656 Change-Id: If46a252147d1d3a0be7d2b19f7bbc36ac1dd338a Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Jüri Valdmann --- src/core/compositor/display_overrides.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/core/compositor/display_overrides.cpp b/src/core/compositor/display_overrides.cpp index 494c7b4d4..89bf8ad2f 100644 --- a/src/core/compositor/display_overrides.cpp +++ b/src/core/compositor/display_overrides.cpp @@ -76,7 +76,10 @@ void gpu::InProcessCommandBuffer::GetTextureQt( void gpu::InProcessCommandBuffer::GetTextureQtOnGpuThread( unsigned int client_id, GetTextureCallback callback) { - MakeCurrent(); + if (!MakeCurrent()) { + LOG(ERROR) << "MakeCurrent failed for GetTextureQt"; + return; + } gpu::TextureBase *texture = decoder_->GetTextureBase(client_id); std::move(callback).Run(texture ? texture->service_id() : 0, gl::GLFence::Create()); } -- cgit v1.2.3