From c0b790cb1f6cd81bec096090cb6e0c364406e20d Mon Sep 17 00:00:00 2001 From: Moshe Kaplan Date: Thu, 3 Jul 2014 09:33:25 -0400 Subject: [PATCH] = Operator should check for self-assignment --- src/RageSoundPosMap.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/RageSoundPosMap.cpp b/src/RageSoundPosMap.cpp index 58eb7ff0d6..76f6828f0a 100644 --- a/src/RageSoundPosMap.cpp +++ b/src/RageSoundPosMap.cpp @@ -46,8 +46,10 @@ pos_map_queue::pos_map_queue( const pos_map_queue &cpy ) pos_map_queue &pos_map_queue::operator=( const pos_map_queue &rhs ) { - delete m_pImpl; - m_pImpl = new pos_map_impl( *rhs.m_pImpl ); + if (this != &rhs){ + delete m_pImpl; + m_pImpl = new pos_map_impl( *rhs.m_pImpl ); + } return *this; }