summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/platforms/cocoa/qcocoabackingstore.mm8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
index 6aa0c0182f..6ea6714649 100644
--- a/src/plugins/platforms/cocoa/qcocoabackingstore.mm
+++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
@@ -357,6 +357,14 @@ QCALayerBackingStore::QCALayerBackingStore(QWindow *window)
NSView *view = static_cast<QCocoaWindow *>(window->handle())->view();
m_backingPropertiesObserver = QMacNotificationObserver(view.window,
NSWindowDidChangeBackingPropertiesNotification, [this]() {
+ if (!this->window()->handle()) {
+ // The platform window has been destroyed, but the backingstore
+ // is still alive, as that's tied to a QWindow. The original
+ // NSWindow we were observing is also likely gone. FIXME:
+ // We should listen for surface events from the QWindow and
+ // remove and re-attach our observer based on those.
+ return;
+ }
qCDebug(lcQpaBackingStore) << "Backing properties for"
<< this->window() << "did change";
backingPropertiesChanged();