summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel/qwidget_qpa.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/kernel/qwidget_qpa.cpp')
-rw-r--r--src/widgets/kernel/qwidget_qpa.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp
index c2b60d0387..2120e40c57 100644
--- a/src/widgets/kernel/qwidget_qpa.cpp
+++ b/src/widgets/kernel/qwidget_qpa.cpp
@@ -96,6 +96,12 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
QWindowSurface *surface = q->windowSurface();
QWindow *win = topData()->window;
+ // topData() ensures the extra is created but does not ensure 'window' is non-null
+ // in case the extra was already valid.
+ if (!win) {
+ createTLSysExtra();
+ win = topData()->window;
+ }
win->setWindowFlags(data.window_flags);
win->setGeometry(q->geometry());
@@ -250,8 +256,8 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f)
QPoint QWidget::mapToGlobal(const QPoint &pos) const
{
- int x=pos.x(), y=pos.y();
- const QWidget* w = this;
+ int x = pos.x(), y = pos.y();
+ const QWidget *w = this;
while (w) {
x += w->data->crect.x();
y += w->data->crect.y();
@@ -262,8 +268,8 @@ QPoint QWidget::mapToGlobal(const QPoint &pos) const
QPoint QWidget::mapFromGlobal(const QPoint &pos) const
{
- int x=pos.x(), y=pos.y();
- const QWidget* w = this;
+ int x = pos.x(), y = pos.y();
+ const QWidget *w = this;
while (w) {
x -= w->data->crect.x();
y -= w->data->crect.y();