summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qwindow.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2021-12-28 17:39:21 +0100
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2021-12-30 17:45:07 +0000
commitc760fba40e9f7c9c0883baa07a8561380668700c (patch)
treefb1a04a13f04532931d338c6c09199dc1990271d /src/gui/kernel/qwindow.cpp
parentc064b6bbfda9cbe691b81b67fa8340d89820ee3e (diff)
QWindow: use std::exchange when ... exchanging values
Replaces a three-liner with a more elegant, idiomatic one-liner. Pick-to: 6.3 Change-Id: I57fbe5d808dffa44f6fceffb97c47f0c84ccd3df Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/gui/kernel/qwindow.cpp')
-rw-r--r--src/gui/kernel/qwindow.cpp4
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();