From 2933c7effc2b4857f8d0d82f9c5096aa837a5c92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 13 Jun 2022 15:03:56 +0200 Subject: [PATCH] macOS: Ignore update requests for offline displays Accessing a display that's offline may cause crashes, so to be on the safe side we skip update requests in this situation. Task-number: QTBUG-102021 Change-Id: I6b48b6722bccde628e510c538943d14f2b0271e5 Reviewed-by: Volker Hilsheimer (cherry picked from commit 5909e33d1dea34daef271598eb1c9dd06a238801) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/platforms/cocoa/qcocoascreen.mm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugins/platforms/cocoa/qcocoascreen.mm b/src/plugins/platforms/cocoa/qcocoascreen.mm index 6aad805158b..20efa30d3be 100644 --- a/src/plugins/platforms/cocoa/qcocoascreen.mm +++ b/src/plugins/platforms/cocoa/qcocoascreen.mm @@ -280,6 +280,11 @@ void QCocoaScreen::requestUpdate() { Q_ASSERT(m_displayId); + if (!isOnline()) { + qCDebug(lcQpaScreenUpdates) << this << "is not online. Ignoring update request"; + return; + } + if (!m_displayLink) { CVDisplayLinkCreateWithCGDisplay(m_displayId, &m_displayLink); CVDisplayLinkSetOutputCallback(m_displayLink, [](CVDisplayLinkRef, const CVTimeStamp*,