Close handle if valid for move assignment

LTO-timing^2
ζeh Matt 2 years ago
parent 8a724eb772
commit 8f7ec42c09
No known key found for this signature in database
GPG Key ID: 18CE582C71A225B0

@ -45,6 +45,8 @@ namespace Platform::File {
ScopedHandle& operator=(const ScopedHandle& other) = delete;
ScopedHandle& operator=(ScopedHandle&& other) noexcept
{
if (mHandle != Handle::Invalid)
close(mHandle);
mHandle = other.mHandle;
other.mHandle = Handle::Invalid;
return *this;

Loading…
Cancel
Save