QScopedPointer: streamline code with qExchange
Change-Id: I88059d2c484fa2762ec0fc526d81db543043b58b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
dda6a7497e
commit
b119b17717
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user