diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-01-15 15:00:01 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-01-15 18:05:19 +0100 |
commit | 7f5d41e286e043c5f3061e2eb5a0128102a38c80 (patch) | |
tree | 492eb2a96fefbb2b24d00c85e19609216dc4b7b5 /src/widgets/kernel/qwidgetwindow.cpp | |
parent | 98a89fb711a15fcf9f541f7b4a8ae7492e5a445c (diff) |
Windows: Fix dialog moving up after closing/reshowing
A resize event delivered after closing the platform window
was causing the stored frame margins to be cleared.
Bail out of QWidgetWindow::updateMargins() if the
platform window is null.
Pick-to: 5.15
Fixes: QTBUG-79147
Change-Id: Iebbc90c3cccafa209cd720baedf45affb3f3c2b8
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/widgets/kernel/qwidgetwindow.cpp')
-rw-r--r-- | src/widgets/kernel/qwidgetwindow.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index ae1e461d7a..cdc358aca2 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -736,8 +736,12 @@ bool QWidgetWindow::updateSize() void QWidgetWindow::updateMargins() { - const QMargins margins = frameMargins(); + // QTBUG-79147 (Windows): Bail out on resize events after closing a dialog + // and destroying the platform window which would clear the margins. QTLWExtra *te = m_widget->d_func()->topData(); + if (te->window == nullptr || te->window->handle() == nullptr) + return; + const QMargins margins = frameMargins(); te->posIncludesFrame= false; te->frameStrut.setCoords(margins.left(), margins.top(), margins.right(), margins.bottom()); m_widget->data->fstrut_dirty = false; |