macOS: Use QPointer to track QNSView -> QCocoaWindow

Change-Id: I4de581dda03d25e781112eff34de28dfd1797a7f
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
Tor Arne Vestbø 2016-10-12 15:04:11 +02:00
parent 1d6eb70dce
commit 2f505b79a4
3 changed files with 1 additions and 15 deletions

View File

@ -433,13 +433,6 @@ QCocoaWindow::~QCocoaWindow()
if (window()->type() != Qt::ForeignWindow)
[[NSNotificationCenter defaultCenter] removeObserver:m_view];
// The QNSView object may outlive the corresponding QCocoaWindow object,
// for example during app shutdown when the QNSView is embedded in a
// foregin NSView hiearchy. Clear the pointers to the QWindow/QCocoaWindow
// here to make sure QNSView does not dereference stale pointers.
if (window()->type() != Qt::ForeignWindow)
[qnsview_cast(m_view) clearQWindowPointers];
// While it is unlikely that this window will be in the popup stack
// during deletetion we clear any pointers here to make sure.
if (QCocoaIntegration::instance()) {

View File

@ -65,7 +65,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper));
uchar *m_maskData;
bool m_shouldInvalidateWindowShadow;
QPointer<QWindow> m_window;
QCocoaWindow *m_platformWindow;
QPointer<QCocoaWindow> m_platformWindow;
NSTrackingArea *m_trackingArea;
Qt::MouseButtons m_buttons;
Qt::MouseButtons m_acceptedMouseDowns;
@ -92,7 +92,6 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper));
- (id)init;
- (id)initWithQWindow:(QWindow *)window platformWindow:(QCocoaWindow *) platformWindow;
- (void) clearQWindowPointers;
#ifndef QT_NO_OPENGL
- (void)setQCocoaGLContext:(QCocoaGLContext *)context;
#endif

View File

@ -229,12 +229,6 @@ static bool _q_dontOverrideCtrlLMB = false;
return self;
}
- (void) clearQWindowPointers
{
m_window = 0;
m_platformWindow = 0;
}
#ifndef QT_NO_OPENGL
- (void) setQCocoaGLContext:(QCocoaGLContext *)context
{