I think there's a bug in Path::addPath

Or is it something intrinsically silly in adding a path to itself like

path.addTriangle({ 0.0f, 0.0f }, { 0.71f, 0.5f }, { 0, 1.0f });
path.closeSubPath();
path.addPath(path, AffineTransform().translated(1.0f, 0.0f));

?

in Path::addPath the markers of the path being added are looped through like

 for (int i = 0; i < other.data.size();)
 {
 	//add markers to destination path i.e this
 }

but while other.data is the same as this.data (the path is added to itself, remember)
the number of markers will never run out… :frowning:

The catastrophy can be avoided by simply changing the code to

 auto numSourceMarkers = other.data.size();

 for (int i = 0; i < numSourceMarkers;)
 {
    //add markers to destination path but stop in time
 }

I think.

1 Like

Thanks, that’s added here:

Thanks!

Could you do the same to

void Path::addPath (const Path& other, const AffineTransform& transformToApply)

Whoops, thanks:

:partying_face: I mark the subject as solved…