From 5909e33d1dea34daef271598eb1c9dd06a238801 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: 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 Pick-to: 6.2 6.3 6.4 5.15 Change-Id: I6b48b6722bccde628e510c538943d14f2b0271e5 Reviewed-by: Volker Hilsheimer --- src/plugins/platforms/cocoa/qcocoascreen.mm | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/plugins/platforms/cocoa') diff --git a/src/plugins/platforms/cocoa/qcocoascreen.mm b/src/plugins/platforms/cocoa/qcocoascreen.mm index 1d2b93cd48..923e5c09ad 100644 --- a/src/plugins/platforms/cocoa/qcocoascreen.mm +++ b/src/plugins/platforms/cocoa/qcocoascreen.mm @@ -275,6 +275,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*, -- cgit v1.2.3