diff options
-rw-r--r-- | src/archive/ArchiveFile.hxx | 9 | ||||
-rw-r--r-- | src/archive/plugins/Bzip2ArchivePlugin.cxx | 4 | ||||
-rw-r--r-- | src/archive/plugins/Iso9660ArchivePlugin.cxx | 4 | ||||
-rw-r--r-- | src/archive/plugins/ZzipArchivePlugin.cxx | 4 | ||||
-rw-r--r-- | src/db/update/Archive.cxx | 2 | ||||
-rw-r--r-- | src/input/plugins/ArchiveInputPlugin.cxx | 2 | ||||
-rw-r--r-- | test/visit_archive.cxx | 2 |
7 files changed, 4 insertions, 23 deletions
diff --git a/src/archive/ArchiveFile.hxx b/src/archive/ArchiveFile.hxx index 3fa1f796b..72f72d7b9 100644 --- a/src/archive/ArchiveFile.hxx +++ b/src/archive/ArchiveFile.hxx @@ -22,19 +22,12 @@ class Mutex; class Cond; -struct ArchivePlugin; class ArchiveVisitor; class InputStream; class ArchiveFile { -protected: - /** - * Use Close() instead of delete. - */ - ~ArchiveFile() {} - public: - virtual void Close() = 0; + virtual ~ArchiveFile() noexcept = default; /** * Visit all entries inside this archive. diff --git a/src/archive/plugins/Bzip2ArchivePlugin.cxx b/src/archive/plugins/Bzip2ArchivePlugin.cxx index b5f4de055..b8bad8826 100644 --- a/src/archive/plugins/Bzip2ArchivePlugin.cxx +++ b/src/archive/plugins/Bzip2ArchivePlugin.cxx @@ -49,10 +49,6 @@ public: name.erase(len - 4); } - virtual void Close() override { - delete this; - } - virtual void Visit(ArchiveVisitor &visitor) override { visitor.VisitArchiveEntry(name.c_str()); } diff --git a/src/archive/plugins/Iso9660ArchivePlugin.cxx b/src/archive/plugins/Iso9660ArchivePlugin.cxx index beb73eddb..62f61d596 100644 --- a/src/archive/plugins/Iso9660ArchivePlugin.cxx +++ b/src/archive/plugins/Iso9660ArchivePlugin.cxx @@ -72,10 +72,6 @@ public: void Visit(char *path, size_t length, size_t capacity, ArchiveVisitor &visitor); - virtual void Close() override { - delete this; - } - virtual void Visit(ArchiveVisitor &visitor) override; InputStream *OpenStream(const char *path, diff --git a/src/archive/plugins/ZzipArchivePlugin.cxx b/src/archive/plugins/ZzipArchivePlugin.cxx index 2d156c025..e69c7679d 100644 --- a/src/archive/plugins/ZzipArchivePlugin.cxx +++ b/src/archive/plugins/ZzipArchivePlugin.cxx @@ -57,10 +57,6 @@ public: ZzipArchiveFile(std::shared_ptr<ZzipDir> &&_dir) :dir(std::move(_dir)) {} - virtual void Close() override { - delete this; - } - virtual void Visit(ArchiveVisitor &visitor) override; InputStream *OpenStream(const char *path, diff --git a/src/db/update/Archive.cxx b/src/db/update/Archive.cxx index e322c8ed3..d20bbf462 100644 --- a/src/db/update/Archive.cxx +++ b/src/db/update/Archive.cxx @@ -177,7 +177,7 @@ UpdateWalk::UpdateArchiveFile(Directory &parent, const char *name, UpdateArchiveVisitor visitor(*this, *file, directory); file->Visit(visitor); - file->Close(); + delete file; } bool diff --git a/src/input/plugins/ArchiveInputPlugin.cxx b/src/input/plugins/ArchiveInputPlugin.cxx index fc1567a54..72caf7fa2 100644 --- a/src/input/plugins/ArchiveInputPlugin.cxx +++ b/src/input/plugins/ArchiveInputPlugin.cxx @@ -63,7 +63,7 @@ OpenArchiveInputStream(Path path, Mutex &mutex, Cond &cond) auto file = archive_file_open(arplug, Path::FromFS(archive)); AtScopeExit(file) { - file->Close(); + delete file; }; return InputStreamPtr(file->OpenStream(filename, mutex, cond)); diff --git a/test/visit_archive.cxx b/test/visit_archive.cxx index c16d8e5e9..490bc7c4a 100644 --- a/test/visit_archive.cxx +++ b/test/visit_archive.cxx @@ -93,7 +93,7 @@ try { MyArchiveVisitor visitor; file->Visit(visitor); - file->Close(); + delete file; return result; } catch (const std::exception &e) { |