diff --git a/libraries/libstratosphere/include/stratosphere/ncm/ncm_submission_package_install_task.hpp b/libraries/libstratosphere/include/stratosphere/ncm/ncm_submission_package_install_task.hpp index 97ed4c822..7a3b08b33 100644 --- a/libraries/libstratosphere/include/stratosphere/ncm/ncm_submission_package_install_task.hpp +++ b/libraries/libstratosphere/include/stratosphere/ncm/ncm_submission_package_install_task.hpp @@ -25,8 +25,8 @@ namespace ams::ncm { private: std::unique_ptr impl; public: - SubmissionPackageInstallTask() { /* ... */ } - virtual ~SubmissionPackageInstallTask() override { /* ... */ } + SubmissionPackageInstallTask(); + virtual ~SubmissionPackageInstallTask() override; Result Initialize(fs::FileHandle handle, StorageId storage_id, void *buffer, size_t buffer_size, bool ignore_ticket); }; diff --git a/libraries/libstratosphere/source/ncm/ncm_submission_package_install_task.cpp b/libraries/libstratosphere/source/ncm/ncm_submission_package_install_task.cpp index 7d386316b..37f702277 100644 --- a/libraries/libstratosphere/source/ncm/ncm_submission_package_install_task.cpp +++ b/libraries/libstratosphere/source/ncm/ncm_submission_package_install_task.cpp @@ -23,7 +23,8 @@ namespace ams::ncm { fs::FileHandleStorage storage; std::optional mount_name; public: - explicit Impl(fs::FileHandle handle) : storage(handle), mount_name(std::nullopt) { /* ... */ } + explicit Impl(fs::FileHandle file) : storage(file), mount_name(std::nullopt) { /* ... */ } + ~Impl() { if (this->mount_name) { fs::fsa::Unregister(this->mount_name->str); @@ -47,21 +48,18 @@ namespace ams::ncm { } const impl::MountName &GetMountName() const { - return this->mount_name; + return *this->mount_name; } }; - SubmissionPackageInstallTask::~SubmissionPackageInstallTask() { - if (this->impl != nullptr) { - delete this->impl; - } - } + SubmissionPackageInstallTask::SubmissionPackageInstallTask() { /* ... */ } + SubmissionPackageInstallTask::~SubmissionPackageInstallTask() { /* ... */ } - Result SubmissionPackageInstallTask::Initialize(fs::FileHandle handle, StorageId storage_id, void *buffer, size_t buffer_size, bool ignore_ticket) { + Result SubmissionPackageInstallTask::Initialize(fs::FileHandle file, StorageId storage_id, void *buffer, size_t buffer_size, bool ignore_ticket) { AMS_ASSERT(!this->impl); - + /* Allocate impl. */ - this->impl.reset(new (std::nothrow) Impl(handle)); + this->impl.reset(new (std::nothrow) Impl(file)); R_UNLESS(this->impl != nullptr, ncm::ResultAllocationFailed()); /* Initialize impl. */