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:
parent
1d6eb70dce
commit
2f505b79a4
@ -433,13 +433,6 @@ QCocoaWindow::~QCocoaWindow()
|
|||||||
if (window()->type() != Qt::ForeignWindow)
|
if (window()->type() != Qt::ForeignWindow)
|
||||||
[[NSNotificationCenter defaultCenter] removeObserver:m_view];
|
[[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
|
// While it is unlikely that this window will be in the popup stack
|
||||||
// during deletetion we clear any pointers here to make sure.
|
// during deletetion we clear any pointers here to make sure.
|
||||||
if (QCocoaIntegration::instance()) {
|
if (QCocoaIntegration::instance()) {
|
||||||
|
@ -65,7 +65,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper));
|
|||||||
uchar *m_maskData;
|
uchar *m_maskData;
|
||||||
bool m_shouldInvalidateWindowShadow;
|
bool m_shouldInvalidateWindowShadow;
|
||||||
QPointer<QWindow> m_window;
|
QPointer<QWindow> m_window;
|
||||||
QCocoaWindow *m_platformWindow;
|
QPointer<QCocoaWindow> m_platformWindow;
|
||||||
NSTrackingArea *m_trackingArea;
|
NSTrackingArea *m_trackingArea;
|
||||||
Qt::MouseButtons m_buttons;
|
Qt::MouseButtons m_buttons;
|
||||||
Qt::MouseButtons m_acceptedMouseDowns;
|
Qt::MouseButtons m_acceptedMouseDowns;
|
||||||
@ -92,7 +92,6 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper));
|
|||||||
|
|
||||||
- (id)init;
|
- (id)init;
|
||||||
- (id)initWithQWindow:(QWindow *)window platformWindow:(QCocoaWindow *) platformWindow;
|
- (id)initWithQWindow:(QWindow *)window platformWindow:(QCocoaWindow *) platformWindow;
|
||||||
- (void) clearQWindowPointers;
|
|
||||||
#ifndef QT_NO_OPENGL
|
#ifndef QT_NO_OPENGL
|
||||||
- (void)setQCocoaGLContext:(QCocoaGLContext *)context;
|
- (void)setQCocoaGLContext:(QCocoaGLContext *)context;
|
||||||
#endif
|
#endif
|
||||||
|
@ -229,12 +229,6 @@ static bool _q_dontOverrideCtrlLMB = false;
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) clearQWindowPointers
|
|
||||||
{
|
|
||||||
m_window = 0;
|
|
||||||
m_platformWindow = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef QT_NO_OPENGL
|
#ifndef QT_NO_OPENGL
|
||||||
- (void) setQCocoaGLContext:(QCocoaGLContext *)context
|
- (void) setQCocoaGLContext:(QCocoaGLContext *)context
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user