- 
    Bug 
- 
    Resolution: Done
- 
    P1: Critical 
- 
    5.13.0
- 
    None
- 
    MacBook Pro 13" 2018 4xTB
 macOS Catalina 10.15 Beta (19A526h)
 Displays: 2 x LG 24UD58-B (4K)
 Sonnet Thunderbolt 3 to Dual DisplayPort Adapter
(sidenote: this setup is a little bit quirky, sometimes during waking up one of the displays wakes up as 1080p (or 4K@30Hz), requires turning it off/on and switching resolution. Still, none of these should cause crashes and assertions).
The problem seems to be new code in qcocoascreen.mm; The callback registered through CGDisplayRegisterReconfigurationCallback is fired with events in order Qt can't handle properly.
Also Qt makes assumptions that seems not to be true:
For example the callback is invoked with displayId == 4128830 and flags == 4368 (kCGDisplayAddFlag, kCGDisplayEnabledFlag, kCGDisplayDesktopShapeChangedFlag), so Qt assumes CGDisplayCreateUUIDFromDisplayID will return valid value (to match displayId with NSScreen), but in my case CGDisplayCreateUUIDFromDisplayID(4128830) returns null despite callback being called with added/enabled flags. This causes assertion in QCocoaScreen::updateProperties()
Also note that in this situation, there are two [NSScreen screens] present, but neither deviceDescription->NSScreenNumber matches the displayId;
Edit: Attached a workaround patch I'm testing right now that seems to solve the assertions and crashes in this case. While not a proper solution, It still might be helpful.
- relates to
- 
                    QTCREATORBUG-23211 Qt Creator crash when macOS goes to sleep. -           
- Closed
 
-         
- 
                    QTBUG-79633 Application crashes when Mac returns from sleep -         
- Closed
 
-         
- 
                    QTCREATORBUG-21614 Occasional crashes when changing screen configuration -         
- Closed
 
-         
| For Gerrit Dashboard: QTBUG-77656 | ||||||
|---|---|---|---|---|---|---|
| # | Subject | Branch | Project | Status | CR | V | 
| 356768,7 | macOS: Stop relying on balanced CGDisplay reconfiguration callbacks | dev | qt/qtbase | Status: MERGED | +2 | 0 | 
| 362817,2 | macOS: Stop relying on balanced CGDisplay reconfiguration callbacks | 6.1 | qt/qtbase | Status: MERGED | +2 | 0 | 
| 362818,2 | macOS: Stop relying on balanced CGDisplay reconfiguration callbacks | 6.2 | qt/qtbase | Status: MERGED | +2 | 0 | 
| 362822,2 | macOS: Stop relying on balanced CGDisplay reconfiguration callbacks | tqtc/lts-5.15 | qt/tqtc-qtbase | Status: MERGED | +2 | 0 |