summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoawindow.h
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2017-07-17 12:13:58 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2017-07-17 13:05:55 +0000
commit4c855a9f9ff523e2753157897100393d14bf2f9e (patch)
treeb2d757ff234415011397e1f520654f87e2946937 /src/plugins/platforms/cocoa/qcocoawindow.h
parent1e8a687a3a1d9a8ef6cec5be4911b8ff584e9825 (diff)
Add QPlatformWindow::initialize() for two-step window creation
The QWindow::create method calls createPlatformWindow, and assigns the result to d->platformWindow. If the platform sends any sort of events synchronously during the creation, the event will be delivered to a QWindow that doesn't have a handle() yet, resulting in noop handling of the event, or crashes. To mitigate this situations, platforms should do as little a possible in the QPlatformWindow constructor, and leave initialization to the new method, where the QWindow will have a handle(). The macOS platform plugin still has a m_initialized guard, to prevent sending geometry changes during initialization, as this will result in a resize event before a show event. This forced behavior seems dubious, but is left for a followup patch. Task-number: QTBUG-61977 Change-Id: I04d32d93391e89d068752b719270438e7024ad46 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoawindow.h')
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h
index 4b616665f7..e2fb372dae 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.h
+++ b/src/plugins/platforms/cocoa/qcocoawindow.h
@@ -95,6 +95,8 @@ public:
QCocoaWindow(QWindow *tlw, WId nativeHandle = 0);
~QCocoaWindow();
+ void initialize() override;
+
void setGeometry(const QRect &rect) Q_DECL_OVERRIDE;
QRect geometry() const Q_DECL_OVERRIDE;
void setCocoaGeometry(const QRect &rect);
@@ -250,7 +252,7 @@ public: // for QNSView
QPointer<QWindow> m_enterLeaveTargetWindow;
bool m_windowUnderMouse;
- bool m_inConstructor;
+ bool m_initialized;
bool m_inSetVisible;
bool m_inSetGeometry;
bool m_inSetStyleMask;