Skip to content

macOS: do not require the nonactivating style bit once an owned Cocoa popup is shown - #1

Merged
lextm merged 1 commit into
codex/macos-package-validationfrom
fix/cocoa-popup-stylemask
Oct 26, 2026
Merged

lextm merged 1 commit into
codex/macos-package-validationfrom
fix/cocoa-popup-stylemask

Conversation

@lextm

@lextm lextm commented Oct 26, 2026 •

Copy link
Copy Markdown

Fixes the macOS crash reported upstream as wieslawsoltes#401: opening any Popup/ContextMenu throws
The owned Cocoa popup identity changed from CocoaOwnedPopupSurface.Enter().

Cause

OwnedOperations.IsCurrent requires styleMask == NSWindowStyleMaskNonactivatingPanel. The panel keeps that bit through
creation, addChildWindow:ordered: and orderFront:, the show succeeds, and the next IsCurrent reads styleMask == 0
(all other checks true). The likely cause is AppKit reporting the bit as cleared once the panel is ordered in as a child; not confirmed.

Change

One line: reject only style bits the panel was never given ((styleMask & ~NonactivatingPanelStyle) == 0) instead of requiring
the creation-time value exactly. Every other identity check is unchanged.

Verified (OpenDevelop, macOS 27.0.1, this change in the host)

  • Real right-click ContextMenu: 3 runs in a row pass (one earlier run failed because the click was not delivered; the menu never opened and there was no exception). A toolbar button opening a ContextMenu: passes once on its own and once inside the full suite. No identity changed and no FATAL in any run.
  • Full Terminal pad suite: 23/23 (the Terminal add-in also had to stop drawing toolbar/find-bar buttons as ▲▼✕▾, a separate issue).

Not verified

  • Windows/Linux (the change is in the Cocoa-only file), other popup kinds (main menu, ComboBox, ToolTip), and CI.
  • Whether the conservative form (masking out the nonactivating bit) behaves differently from dropping the comparison, which is what was
    run first; the form in this PR is what the 3-run and 23-test results above used.

Not done here

Per openavalon/AGENTS.md, a ProGPU change needs LibreWPF's and LibreWinForms' ProGPU submodules advanced to the same commit and the
packages republished. That is not part of this PR.

… is shown

Opening any Popup or ContextMenu on macOS threw "The owned Cocoa popup identity changed" from
CocoaOwnedPopupSurface.Enter() and, in a host that does not catch it, ended the process.

OwnedOperations.IsCurrent compared the panel's styleMask with NSWindowStyleMaskNonactivatingPanel. Traced step by step, the
panel keeps that bit through creation, addChildWindow:ordered: and orderFront:, the show succeeds (host identity, visibility,
parent and hidesOnDeactivate all hold), and the next IsCurrent reads styleMask == 0. Every other check in IsCurrent is
true at that point. Nothing in ProGPU writes the panel's style after creation; the likely cause is AppKit reporting the
bit as cleared once the panel is ordered in as a child, which was not confirmed.

Reject only style bits the panel was never given instead of requiring the creation-time value exactly. The other identity
checks (panel and view class, content view and window links, nil delegate, NSPanel kind, worksWhenModal,
becomesKeyOnlyIfNeeded, not floating, not released when closed, cannot become key or main, owner lease) are unchanged.

Checked in OpenDevelop on macOS 27.0.1 with this change in the host: a real right-click ContextMenu and a toolbar button that
opens a ContextMenu pass three runs in a row with no "identity changed" and no FATAL, and the full 23-test Terminal pad
suite passes (the Terminal add-in also had to stop drawing toolbar and find-bar buttons as characters, a separate issue).
Reported upstream as wieslawsoltes#401.
@lextm
lextm merged commit dbba4a6 into codex/macos-package-validation Oct 26, 2026
1 check passed
@lextm
lextm deleted the fix/cocoa-popup-stylemask branch October 26, 2026 07:38
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.

1 participant