Closed Bug 1717129 Opened 3 years ago Closed 3 years ago

activateItem sometimes does not activate the item, and instead gets stuck in the NSMenu's tracking event loop

Categories

(Core :: Widget: Cocoa, defect)

All
macOS
defect

Tracking

()

RESOLVED FIXED
91 Branch
Tracking Status
firefox91 --- fixed

People

(Reporter: mstange, Assigned: mstange)

References

Details

Attachments

(1 file)

The problem from bug 1707598 is rearing its head again, in a slightly different form this time.

Some tests are intermittently timing out after calling activateItem. The command event never fires and the thread stays stuck inside the native menu's tracking event loop. This happens in at least two tests with some regularity: bug 1713894 and bug 1706672.

Here's a profile from a failing run.

The crucial aspect seems to be that activateItem is being called while the main thread is inside a nested event loop for nsThread::Shutdown (from an nsThreadPool shutdown runnable). After the call to activateItem, this nested event loop makes a call to -[NSApplication nextEventMatchingMask:...], which seems to confuse the NSMenu.

If we avoid that call, the menu seems to close reliably.

Try push without fix: https://treeherder.mozilla.org/jobs?repo=try&revision=9e4643bab6591da085027f56ee4e1e22ec5c1c9c
Try push with fix: https://treeherder.mozilla.org/jobs?repo=try&revision=0d4f32f54a2a3f4a0e88e0e5841629c01026fcec

Pushed by mstange@themasta.com:
https://hg.mozilla.org/integration/autoland/rev/bdc520001b3f
Don't call into the native event loop while waiting to unwind into the NSMenu tracking event loop after closing a menu. r=harry
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 91 Branch
No longer blocks: 1706672
Regressions: 1748815
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: