Cocoa: Guard against recursive event delivery
Fix "Recursive repaint" crash. Add guard to QCococaWindow::setGeometry and QNSView updateGeometry to prevent processing window system events during setGeometry. Task-number: QTBUG-41449 Change-Id: I304fdf134d433cbc50fafd997ecd91e31cb57f4e Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
This commit is contained in:
parent
bb31aa853e
commit
7146cbed6e
@ -268,6 +268,7 @@ public: // for QNSView
|
|||||||
|
|
||||||
bool m_inConstructor;
|
bool m_inConstructor;
|
||||||
bool m_inSetVisible;
|
bool m_inSetVisible;
|
||||||
|
bool m_inSetGeometry;
|
||||||
#ifndef QT_NO_OPENGL
|
#ifndef QT_NO_OPENGL
|
||||||
QCocoaGLContext *m_glContext;
|
QCocoaGLContext *m_glContext;
|
||||||
#endif
|
#endif
|
||||||
|
@ -381,6 +381,7 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw)
|
|||||||
, m_windowUnderMouse(false)
|
, m_windowUnderMouse(false)
|
||||||
, m_inConstructor(true)
|
, m_inConstructor(true)
|
||||||
, m_inSetVisible(false)
|
, m_inSetVisible(false)
|
||||||
|
, m_inSetGeometry(false)
|
||||||
#ifndef QT_NO_OPENGL
|
#ifndef QT_NO_OPENGL
|
||||||
, m_glContext(0)
|
, m_glContext(0)
|
||||||
#endif
|
#endif
|
||||||
@ -470,6 +471,8 @@ QSurfaceFormat QCocoaWindow::format() const
|
|||||||
|
|
||||||
void QCocoaWindow::setGeometry(const QRect &rectIn)
|
void QCocoaWindow::setGeometry(const QRect &rectIn)
|
||||||
{
|
{
|
||||||
|
QBoolBlocker inSetGeometry(m_inSetGeometry, true);
|
||||||
|
|
||||||
QRect rect = rectIn;
|
QRect rect = rectIn;
|
||||||
// This means it is a call from QWindow::setFramePosition() and
|
// This means it is a call from QWindow::setFramePosition() and
|
||||||
// the coordinates include the frame (size is still the contents rectangle).
|
// the coordinates include the frame (size is still the contents rectangle).
|
||||||
|
@ -362,7 +362,10 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil;
|
|||||||
if (!m_platformWindow->m_inConstructor) {
|
if (!m_platformWindow->m_inConstructor) {
|
||||||
QWindowSystemInterface::handleGeometryChange(m_window, geometry);
|
QWindowSystemInterface::handleGeometryChange(m_window, geometry);
|
||||||
m_platformWindow->updateExposedGeometry();
|
m_platformWindow->updateExposedGeometry();
|
||||||
QWindowSystemInterface::flushWindowSystemEvents();
|
// Guard against processing window system events during QWindow::setGeometry
|
||||||
|
// calles, which Qt and Qt applications do not excpect.
|
||||||
|
if (!m_platformWindow->m_inSetGeometry)
|
||||||
|
QWindowSystemInterface::flushWindowSystemEvents();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user