From c8c4e5faecedaba7ce74412a51799e5d6c9bb4e3 Mon Sep 17 00:00:00 2001 From: Urs Fleisch Date: Sat, 27 Jan 2024 10:56:31 +0100 Subject: [PATCH] Fix 'get() != pointer()' assertion copying ByteVectorList/StringList (#1211) This reverts dfef09f13 but keeps the assignments as a comment so these functions do not look like they can be defaulted even though they cannot. --- taglib/toolkit/tbytevectorlist.cpp | 6 ++++-- taglib/toolkit/tstringlist.cpp | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/taglib/toolkit/tbytevectorlist.cpp b/taglib/toolkit/tbytevectorlist.cpp index 0088087f..d915148b 100644 --- a/taglib/toolkit/tbytevectorlist.cpp +++ b/taglib/toolkit/tbytevectorlist.cpp @@ -70,7 +70,8 @@ ByteVectorList::~ByteVectorList() = default; ByteVectorList::ByteVectorList(const ByteVectorList &l) : List(l) { - *d = *l.d; + // Uncomment if d is used, d.get() is nullptr and *d behavior undefined + // *d = *l.d; } ByteVectorList::ByteVectorList(std::initializer_list init) : @@ -84,7 +85,8 @@ ByteVectorList &ByteVectorList::operator=(const ByteVectorList &l) return *this; List::operator=(l); - *d = *l.d; + // Uncomment if d is used, d.get() is nullptr and *d behavior undefined + // *d = *l.d; return *this; } diff --git a/taglib/toolkit/tstringlist.cpp b/taglib/toolkit/tstringlist.cpp index aa6acf64..893522fe 100644 --- a/taglib/toolkit/tstringlist.cpp +++ b/taglib/toolkit/tstringlist.cpp @@ -59,7 +59,8 @@ StringList::StringList() = default; StringList::StringList(const StringList &l) : List(l) { - *d = *l.d; + // Uncomment if d is used, d.get() is nullptr and *d behavior undefined + // *d = *l.d; } StringList::StringList(std::initializer_list init) : @@ -73,7 +74,8 @@ StringList &StringList::operator=(const StringList &l) return *this; List::operator=(l); - *d = *l.d; + // Uncomment if d is used, d.get() is nullptr and *d behavior undefined + // *d = *l.d; return *this; }