diff options
author | Dianna Hohensee <dianna.hohensee@mongodb.com> | 2021-02-16 16:02:28 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-02-18 02:52:48 +0000 |
commit | 0b643d8853147c4eb8a2dd3e1dd7fccb62d235f6 (patch) | |
tree | 4cf1dbfdf2498955bd78f5b3edac8eae39a7b581 | |
parent | 408864b34f8e30d3c219af203db71f14f4231738 (diff) | |
download | mongo-0b643d8853147c4eb8a2dd3e1dd7fccb62d235f6.tar.gz |
SERVER-54444 Add a virtual destructor to the Ident base class to ensure defined destructor calls
-rw-r--r-- | src/mongo/db/storage/ident.h | 3 | ||||
-rw-r--r-- | src/mongo/db/storage/record_store.h | 3 | ||||
-rw-r--r-- | src/mongo/db/storage/sorted_data_interface.h | 2 |
3 files changed, 5 insertions, 3 deletions
diff --git a/src/mongo/db/storage/ident.h b/src/mongo/db/storage/ident.h index 151d5e6f2d0..b9125715df3 100644 --- a/src/mongo/db/storage/ident.h +++ b/src/mongo/db/storage/ident.h @@ -38,7 +38,8 @@ namespace mongo { */ class Ident { public: - Ident(StringData ident) : _ident(ident.rawData(), ident.size()) {} + explicit Ident(std::string ident) : _ident(std::move(ident)) {} + virtual ~Ident() = default; const std::string& getIdent() const { return _ident; diff --git a/src/mongo/db/storage/record_store.h b/src/mongo/db/storage/record_store.h index 972ddb9adfa..3d44a0de857 100644 --- a/src/mongo/db/storage/record_store.h +++ b/src/mongo/db/storage/record_store.h @@ -216,7 +216,8 @@ class RecordStore : public Ident { RecordStore& operator=(const RecordStore&) = delete; public: - RecordStore(StringData ns, StringData identName) : Ident(identName), _ns(ns.toString()) {} + RecordStore(StringData ns, StringData identName) + : Ident(identName.toString()), _ns(ns.toString()) {} virtual ~RecordStore() {} diff --git a/src/mongo/db/storage/sorted_data_interface.h b/src/mongo/db/storage/sorted_data_interface.h index ee5df35641c..5e9bde2c9a2 100644 --- a/src/mongo/db/storage/sorted_data_interface.h +++ b/src/mongo/db/storage/sorted_data_interface.h @@ -55,7 +55,7 @@ struct IndexValidateResults; class SortedDataInterface : public Ident { public: SortedDataInterface(StringData ident, KeyString::Version keyStringVersion, Ordering ordering) - : Ident(ident), _keyStringVersion(keyStringVersion), _ordering(ordering) {} + : Ident(ident.toString()), _keyStringVersion(keyStringVersion), _ordering(ordering) {} virtual ~SortedDataInterface() {} |