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>
This commit is contained in:
Marc Mutz 2021-12-28 17:39:21 +01:00 committed by Volker Hilsheimer
parent c064b6bbfd
commit c760fba40e

View File

@ -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();