From 4b4e7f012387330bb7d40855470b6f471d78bfba Mon Sep 17 00:00:00 2001 From: sammycage Date: Sat, 7 Sep 2024 18:48:19 +0100 Subject: [PATCH] Fix Path Reference Sharing Issue --- source/graphics.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/source/graphics.cpp b/source/graphics.cpp index ed1237d..4998eaa 100644 --- a/source/graphics.cpp +++ b/source/graphics.cpp @@ -302,7 +302,7 @@ void Path::addRect(const Rect& rect) void Path::reset() { - plutovg_path_reset(ensure()); + *this = Path(); } Rect Path::boundingRect() const @@ -325,13 +325,16 @@ bool Path::isUnique() const bool Path::parse(const char* data, size_t length) { plutovg_path_reset(ensure()); - return plutovg_path_parse(ensure(), data, length); + return plutovg_path_parse(m_data, data, length); } plutovg_path_t* Path::ensure() { - if(!isUnique()) + if(!isUnique()) { + plutovg_path_destroy(m_data); m_data = plutovg_path_clone(m_data); + } + return m_data; }