Skip to content

Commit

Permalink
Fix Path Reference Sharing Issue
Browse files Browse the repository at this point in the history
  • Loading branch information
sammycage committed Sep 7, 2024
1 parent c981139 commit 4b4e7f0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions source/graphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ void Path::addRect(const Rect& rect)

void Path::reset()
{
plutovg_path_reset(ensure());
*this = Path();
}

Rect Path::boundingRect() const
Expand All @@ -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;
}

Expand Down

0 comments on commit 4b4e7f0

Please sign in to comment.