From 41b54024714071fd97dbadd4a900017544620fae Mon Sep 17 00:00:00 2001 From: Thomas Holder Date: Thu, 21 Nov 2019 11:59:58 +0100 Subject: fix #521 SPIString copy constructor --- src/style-internal.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/style-internal.h') diff --git a/src/style-internal.h b/src/style-internal.h index f395e23d3..bf1eb6d1b 100644 --- a/src/style-internal.h +++ b/src/style-internal.h @@ -614,6 +614,8 @@ public: : SPIBase(inherits) {} + SPIString(const SPIString &rhs) { *this = rhs; } + ~SPIString() override { g_free(_value); } @@ -625,6 +627,9 @@ public: void merge( const SPIBase* const parent ) override; SPIString& operator=(const SPIString& rhs) { + if (this == &rhs) { + return *this; + } SPIBase::operator=(rhs); g_free(_value); _value = g_strdup(rhs._value); @@ -838,6 +843,8 @@ public: this->clear(); } + SPIPaintOrder(const SPIPaintOrder &rhs) { *this = rhs; } + ~SPIPaintOrder() override { g_free( value ); } @@ -857,6 +864,9 @@ public: void merge( const SPIBase* const parent ) override; SPIPaintOrder& operator=(const SPIPaintOrder& rhs) { + if (this == &rhs) { + return *this; + } SPIBase::operator=(rhs); for( unsigned i = 0; i < PAINT_ORDER_LAYERS; ++i ) { layer[i] = rhs.layer[i]; -- cgit v1.2.3