diff --git a/plugins/libimhex/include/hex/helpers/file.hpp b/plugins/libimhex/include/hex/helpers/file.hpp index fad35f296..64bc8ff77 100644 --- a/plugins/libimhex/include/hex/helpers/file.hpp +++ b/plugins/libimhex/include/hex/helpers/file.hpp @@ -25,6 +25,9 @@ namespace hex { explicit File(const std::string &path, Mode mode); File(); + File(const File&) = delete; + File(File &&other) noexcept; + ~File(); bool isValid() { return this->m_file != nullptr; } diff --git a/plugins/libimhex/source/helpers/file.cpp b/plugins/libimhex/source/helpers/file.cpp index b3cb89979..f58793314 100644 --- a/plugins/libimhex/source/helpers/file.cpp +++ b/plugins/libimhex/source/helpers/file.cpp @@ -17,6 +17,11 @@ namespace hex { this->m_file = nullptr; } + File::File(File &&other) noexcept { + this->m_file = other.m_file; + other.m_file = nullptr; + } + File::~File() { if (isValid()) fclose(this->m_file);