From a1bdb0171d8b3a749c73560d0066136cf798a5e6 Mon Sep 17 00:00:00 2001 From: Scott Wheeler Date: Sun, 30 Jul 2023 02:47:00 +0200 Subject: [PATCH] Remove virtual destructors from POD toolkit types This one's been haunting me for a couple decades. "Make all the things virtual!" was kind of a strategy I had for forward compatibility when I wrote this code when I was 20 or so and didn't know better. --- taglib/fileref.cpp | 2 +- taglib/toolkit/tbytevector.h | 2 +- taglib/toolkit/tbytevectorlist.h | 2 +- taglib/toolkit/tlist.h | 2 +- taglib/toolkit/tlist.tcc | 2 +- taglib/toolkit/tmap.h | 2 +- taglib/toolkit/tpropertymap.h | 2 +- taglib/toolkit/trefcounter.h | 2 +- taglib/toolkit/tstring.h | 2 +- taglib/toolkit/tstringlist.h | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/taglib/fileref.cpp b/taglib/fileref.cpp index 2efd2586..1c7a114d 100644 --- a/taglib/fileref.cpp +++ b/taglib/fileref.cpp @@ -299,7 +299,7 @@ public: file(nullptr), stream(nullptr) {} - ~FileRefPrivate() override { + ~FileRefPrivate() { delete file; delete stream; } diff --git a/taglib/toolkit/tbytevector.h b/taglib/toolkit/tbytevector.h index dce39725..b3e5e5bf 100644 --- a/taglib/toolkit/tbytevector.h +++ b/taglib/toolkit/tbytevector.h @@ -95,7 +95,7 @@ namespace TagLib { /*! * Destroys this ByteVector instance. */ - virtual ~ByteVector(); + ~ByteVector(); /*! * Sets the data for the byte array using the first \a length bytes of \a data diff --git a/taglib/toolkit/tbytevectorlist.h b/taglib/toolkit/tbytevectorlist.h index 1849b422..bcc72df3 100644 --- a/taglib/toolkit/tbytevectorlist.h +++ b/taglib/toolkit/tbytevectorlist.h @@ -50,7 +50,7 @@ namespace TagLib { /*! * Destroys this ByteVectorList instance. */ - ~ByteVectorList() override; + ~ByteVectorList(); /*! * Make a shallow, implicitly shared, copy of \a l. Because this is diff --git a/taglib/toolkit/tlist.h b/taglib/toolkit/tlist.h index a943c844..f160239a 100644 --- a/taglib/toolkit/tlist.h +++ b/taglib/toolkit/tlist.h @@ -74,7 +74,7 @@ namespace TagLib { * Destroys this List instance. If auto deletion is enabled and this list * contains a pointer type all of the members are also deleted. */ - virtual ~List(); + ~List(); /*! * Returns an STL style iterator to the beginning of the list. See diff --git a/taglib/toolkit/tlist.tcc b/taglib/toolkit/tlist.tcc index 856c5c45..23a65291 100644 --- a/taglib/toolkit/tlist.tcc +++ b/taglib/toolkit/tlist.tcc @@ -69,7 +69,7 @@ template class List::ListPrivate : public ListPrivateBase public: ListPrivate() : ListPrivateBase() {} ListPrivate(const std::list &l) : ListPrivateBase(), list(l) {} - ~ListPrivate() override { + ~ListPrivate() { clear(); } void clear() { diff --git a/taglib/toolkit/tmap.h b/taglib/toolkit/tmap.h index ed0a0256..b2b1d23e 100644 --- a/taglib/toolkit/tmap.h +++ b/taglib/toolkit/tmap.h @@ -76,7 +76,7 @@ namespace TagLib { /*! * Destroys this instance of the Map. */ - virtual ~Map(); + ~Map(); /*! * Returns an STL style iterator to the beginning of the map. See diff --git a/taglib/toolkit/tpropertymap.h b/taglib/toolkit/tpropertymap.h index 36a94cd5..38cc6053 100644 --- a/taglib/toolkit/tpropertymap.h +++ b/taglib/toolkit/tpropertymap.h @@ -133,7 +133,7 @@ namespace TagLib { */ PropertyMap(const SimplePropertyMap &m); - ~PropertyMap() override; + ~PropertyMap(); /*! * Inserts \a values under \a key in the map. If \a key already exists, diff --git a/taglib/toolkit/trefcounter.h b/taglib/toolkit/trefcounter.h index 65da1ee8..36e8db54 100644 --- a/taglib/toolkit/trefcounter.h +++ b/taglib/toolkit/trefcounter.h @@ -43,7 +43,7 @@ namespace TagLib { public: RefCounter(); - virtual ~RefCounter(); + ~RefCounter(); void ref(); bool deref(); diff --git a/taglib/toolkit/tstring.h b/taglib/toolkit/tstring.h index f83770de..db9f1579 100644 --- a/taglib/toolkit/tstring.h +++ b/taglib/toolkit/tstring.h @@ -185,7 +185,7 @@ namespace TagLib { /*! * Destroys this String instance. */ - virtual ~String(); + ~String(); /*! * Returns a deep copy of this String as an std::string. The returned string diff --git a/taglib/toolkit/tstringlist.h b/taglib/toolkit/tstringlist.h index a0b59676..c657e498 100644 --- a/taglib/toolkit/tstringlist.h +++ b/taglib/toolkit/tstringlist.h @@ -74,7 +74,7 @@ namespace TagLib { /*! * Destroys this StringList instance. */ - ~StringList() override; + ~StringList(); /*! * Concatenate the list of strings into one string separated by \a separator.