Skip to content

deps.qt: Backport fix for QTBUG-147602 - #325

Closed
andreladocruz wants to merge 1 commit into
obsproject:masterfrom
andreladocruz:qt-backport-qtbug-147602
Closed

andreladocruz wants to merge 1 commit into
obsproject:masterfrom
andreladocruz:qt-backport-qtbug-147602

Conversation

@andreladocruz

@andreladocruz andreladocruz commented Oct 20, 2026 •

Copy link
Copy Markdown

Description

Backports the upstream Qt fix for QTBUG-147602 (qtbase commit 08e464f85597, "Fix regression in QImage::toCGImage() with custom color space") to the macOS Qt 6.11.1 build, following the same approach as #318.

qt_mac_cgImageFormatForImage() returned a vImage_CGImageFormat holding a raw CGColorSpaceRef whose owning QCFType was released on return, so QImage::toCGImage() passed a dangling color space to CGImageCreate(). The patch applies cleanly to 6.11.1 and touches only the 5 files that use the changed function.

Motivation and Context

On macOS 27.2 (26B118), OBS Studio 32.2.2 and 33.0.0-rc2 crash on launch with a pointer-authentication trap in CGColorSpaceGetType, called from QImage::toCGImage() during QWidget::setCursor (obsproject/obs-studio#14061). Before macOS 27.2 the system sRGB color space was never actually deallocated, which masked the bug. The fix is in Qt 6.11.2 and 6.12.0.

How Has This Been Tested?

Built Qt 6.11.1 with this patch via CI=1 ./build-qt6.zsh --target macos-arm64 --config Release --shared on the affected machine (Apple M5, macOS 27.2 26B118, Xcode 27.1). Replacing only QtGui.framework in a copy of OBS 33.0.0-rc2 with the patched build fixes the launch crash: the unpatched app crashes every time right after creating the default scene, the patched copy starts normally with no crash reports. Only tested on Apple Silicon; the x86_64 slice was not built. Details in the comments below.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

On macOS 27.2, OBS Studio crashes on launch because
QImage::toCGImage() passes an already-released CGColorSpaceRef to
CGImageCreate(). This is fixed on the Qt 6.11 branch, in 6.11.2 and in
6.12.0.
@Fenrirthviti

Copy link
Copy Markdown
Member

Why was this not actually tested?

Additionally, please fully fill out the PR template. There are several checklist items that were removed.

@andreladocruz

Copy link
Copy Markdown
Author

Fair point, and sorry about the template. I've restored all of it, including the AI disclosure: the diagnosis and this patch were prepared with Claude Code at my direction, which I should have stated from the start.

On testing: I had only verified that the patch applies cleanly to qtbase 6.11.1. I'm now building Qt 6.11.1 with this patch using build-qt6.zsh on the affected machine (Apple M5, macOS 27.2 26B118), and will drop the patched QtGui into OBS 33.0.0-rc2 to confirm it launches. I'll report the results here.

@Fenrirthviti

Copy link
Copy Markdown
Member

Thanks for the update. Per our contribution policy, we do not accept AI generated code.

@andreladocruz

Copy link
Copy Markdown
Author

Tested. I built Qt 6.11.1 with this patch using CI=1 ./build-qt6.zsh --target macos-arm64 --config Release --shared (same arguments as the CI action) on the affected machine: Apple M5 (Mac17,2), macOS 27.2 (26B118), Xcode 27.1 / macOS SDK 27.0. The patch applied cleanly and the build succeeded; the resulting QtGui contains the new QCGImageFormat type and no longer links Accelerate.

Runtime test: a copy of the official OBS 33.0.0-rc2 app with only QtGui.framework replaced by the patched build (ad-hoc re-signed, arm64 only).

  • Unpatched OBS 33.0.0-rc2: crashes on every launch right after "No scene file found, creating default scene" (QImage::toCGImage → CGColorSpaceGetType PAC trap).
  • Patched copy: gets past startup ("Switched to scene"), the main window opens normally, and no new crash reports are generated.

Note: building against the macOS 27.0 SDK prints Qt's "only tested with version 26 of the platform SDK" warning; it's a warning only.

@andreladocruz

Copy link
Copy Markdown
Author
image

@andreladocruz

Copy link
Copy Markdown
Author

@Fenrirthviti ☝️ ☝️ ☝️ ☝️ ☝️ ☝️ ☝️ ☝️

@Fenrirthviti

Copy link
Copy Markdown
Member

Linus' takes here are handwaving a significant number of concerns regarding AI. He has decided the only thing that matters is code correctness and responsibility. That's his opinion, and he's welcome to it. There are a wealth of other issues that come with LLMs which have lead to our stance to not accept it, not the least of which being that LLM-generated code cannot be reasonably copyrighted and therefor is not GPL compliant.

Some recommended reading: https://kristoff.it/blog/contributor-poker-and-ai/

When you submit code to us, you're asking us to review the code for correctness, and we are not interested in talking to your agent. Especially in cases where the most basic courtesy of reading our contribution guidelines was a skipped step.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants