summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoawindow.h
diff options
context:
space:
mode:
authorTimur Pocheptsov <timur.pocheptsov@theqtcompany.com>2016-04-21 10:02:17 +0200
committerGabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>2016-04-22 01:20:44 +0000
commit5b54c352edbc597ec5283bc9cfdd77906350161f (patch)
tree2d999bab79bf6211c35b24a10832f0d74e58507c /src/plugins/platforms/cocoa/qcocoawindow.h
parent072485048fc8360b822e35b4cc43b0728e04cc1b (diff)
Cocoa integration - add a protection against dangling pointers
Backport watcher-sentinel trick (QPointer->QObject) from dev. Task-number: QTBUG-42059 Change-Id: I9b2c7cde635c2ed9a3f667f216da62870d0b5ccb Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoawindow.h')
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h
index 05e6cf3c9e..e60ca196ac 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.h
+++ b/src/plugins/platforms/cocoa/qcocoawindow.h
@@ -66,6 +66,7 @@ typedef NSWindow<QNSWindowProtocol> QCocoaNSWindow;
QCocoaWindow *_platformWindow;
BOOL _grabbingMouse;
BOOL _releaseOnMouseUp;
+ QPointer<QObject> _watcher;
}
@property (nonatomic, readonly) QCocoaNSWindow *window;
@@ -315,6 +316,11 @@ public: // for QNSView
};
QHash<quintptr, BorderRange> m_contentBorderAreas; // identifer -> uppper/lower
QHash<quintptr, bool> m_enabledContentBorderAreas; // identifer -> enabled state (true/false)
+
+ // This object is tracked by a 'watcher'
+ // object in a window helper, preventing use of dangling
+ // pointers.
+ QObject sentinel;
};
QT_END_NAMESPACE