From 2645101051d94a2062ac30a0c084c20a6dd86ab0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= Date: Sun, 17 Nov 2024 08:16:46 +0100 Subject: [PATCH 5/5] Remove dangerous ptrList assignment operator The semantics of the implementation are broken. According the method signature the RHS should not be modified (const), but the implementation moves the content ownership to the LHS. --- trunk/src/ptrList.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/trunk/src/ptrList.h b/trunk/src/ptrList.h index 09d6cd7..ee23c32 100644 --- a/trunk/src/ptrList.h +++ b/trunk/src/ptrList.h @@ -38,7 +38,7 @@ template < class T > class ptrListItem // Operators - ptrListItem& operator= ( const ptrListItem& item ); + // ptrListItem& operator= ( const ptrListItem& item ); // Linked list functions. ptrListItem* next(); @@ -200,6 +200,7 @@ template < class T > ptrListItem::ptrListItem ( T* ptr, ptrListItem* chain prevLnk = 0; } +#if 0 template < class T > ptrListItem& ptrListItem::operator= ( const ptrListItem& item ) { // Assignment Operator. @@ -220,6 +221,7 @@ template < class T > ptrListItem& ptrListItem::operator= ( const ptrListIt return *this; } +#endif template < class T > ptrListItem* ptrListItem::next() { -- 2.47.0