QScopedPointer: streamline code with qExchange

Change-Id: I88059d2c484fa2762ec0fc526d81db543043b58b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Giuseppe D'Angelo 2020-11-01 15:20:23 +01:00
parent dda6a7497e
commit b119b17717

View File

@ -156,8 +156,7 @@ public:
{
if (d == other)
return;
T *oldD = d;
d = other;
T *oldD = qExchange(d, other);
Cleanup::cleanup(oldD);
}
@ -165,8 +164,7 @@ public:
QT_DEPRECATED_VERSION_X_6_1("Use std::unique_ptr instead, and call release().")
T *take() noexcept
{
T *oldD = d;
d = nullptr;
T *oldD = qExchange(d, nullptr);
return oldD;
}
#endif