Skip to content

Commit a5b5e64

Browse files
mibruninAllan Sandfeld Jensen
authored andcommitted
[macOS] Do not subscribe to display callbacks when GPU is disabled
The callbacks are handled as a GPU info update, which will lead to a crash because the shared contexts cannot be initialized. Additionally, check if the context state could be successfully initialized before trying to update the GPU info. Pick-to: 108-based Task-number: QTBUG-114752 Change-Id: Idfe7de3e429c49d57874bb82f503e7bb863aa899 Reviewed-on: https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/492881 Reviewed-by: Michal Klocek <[email protected]>
1 parent c571cc2 commit a5b5e64

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

chromium/components/viz/service/gl/gpu_service_impl.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,10 @@ void GpuServiceImpl::UpdateGPUInfo() {
545545

546546
void GpuServiceImpl::UpdateGPUInfoGL() {
547547
DCHECK(main_runner_->BelongsToCurrentThread());
548-
gpu::CollectGraphicsInfoGL(&gpu_info_, GetContextState()->display());
548+
scoped_refptr<gpu::SharedContextState> context_state = GetContextState();
549+
if (!context_state.get())
550+
return;
551+
gpu::CollectGraphicsInfoGL(&gpu_info_, context_state->display());
549552
gpu_host_->DidUpdateGPUInfo(gpu_info_);
550553
}
551554

chromium/content/browser/gpu/gpu_data_manager_impl_private.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,9 @@ GpuDataManagerImplPrivate::GpuDataManagerImplPrivate(GpuDataManagerImpl* owner)
510510
}
511511

512512
#if BUILDFLAG(IS_MAC)
513-
CGDisplayRegisterReconfigurationCallback(DisplayReconfigCallback, owner_);
513+
if (!command_line->HasSwitch(switches::kDisableGpu)) {
514+
CGDisplayRegisterReconfigurationCallback(DisplayReconfigCallback, owner_);
515+
}
514516
#endif // BUILDFLAG(IS_MAC)
515517

516518
// For testing only.

0 commit comments

Comments
 (0)