diff options
author | Marc Mutz <marc.mutz@qt.io> | 2021-12-28 17:39:21 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-12-30 17:51:34 +0000 |
commit | 097eafa9476aff65e5c605ac6543618ac858bddb (patch) | |
tree | 55b88a0ee3bdd961acb18e2cc41fed6e2ac7b0c0 /src/gui/kernel | |
parent | 5649990c21c8cf666e7124ebbd694fc715d6cde7 (diff) |
QWindow: use std::exchange when ... exchanging values
Replaces a three-liner with a more elegant, idiomatic one-liner.
Change-Id: I57fbe5d808dffa44f6fceffb97c47f0c84ccd3df
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit c760fba40e9f7c9c0883baa07a8561380668700c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qwindow.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 589304ccfc..030628b5db 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -2002,9 +2002,7 @@ void QWindowPrivate::destroy() // Unset platformWindow before deleting, so that the destructor of the // platform window does not recurse back into the platform window via // this window during destruction (e.g. as a result of platform events). - QPlatformWindow *pw = platformWindow; - platformWindow = nullptr; - delete pw; + delete std::exchange(platformWindow, nullptr); if (QGuiApplicationPrivate::focus_window == q) QGuiApplicationPrivate::focus_window = q->parent(); |