From: Jerome St-Louis Date: Sun, 20 Sep 2015 15:55:32 +0000 (+0900) Subject: Butterbur: Fixed double free, freeing VBO, freeing nodes X-Git-Url: https://ecere.com/cgi-bin/gitweb.cgi?p=sdk;a=commitdiff_plain;h=cfc821695b672cc5cbe6ece84355d8ea01cdd578 Butterbur: Fixed double free, freeing VBO, freeing nodes --- diff --git a/butterbur/src/butterbur.ec b/butterbur/src/butterbur.ec index 425dadf..c7ed827 100644 --- a/butterbur/src/butterbur.ec +++ b/butterbur/src/butterbur.ec @@ -144,9 +144,16 @@ class BBPath : BBObject CapType cap; bool closed; bool noJoin; - int lineCount; + int lineCount, fillCount; lineColor = black; + ~BBPath() + { + fillIndices.free(); + lineIndices.free(); + vbo.free(); + } + property ColorAlpha lineColor { set { lineColor = value; } @@ -350,11 +357,14 @@ class BBPath : BBObject delete points; if(closed) + { fillIndices.upload(tc * sizeof(uint16), ixFill); + fillCount = tc; + } - delete ixFill; if(ixFill != ix) delete ix; + delete ixFill; } void render() @@ -365,7 +375,7 @@ class BBPath : BBObject if(closed) { glimtkColor4f(fillColor.color.r/255.0f, fillColor.color.g/255.0f, fillColor.color.b/255.0f, fillColor.a/255.0f); - fillIndices.draw(GLIMTKMode::triangleFan, nodes.count, glTypeUnsignedShort, null); + fillIndices.draw(GLIMTKMode::triangleFan, fillCount, glTypeUnsignedShort, null); } // Line @@ -450,6 +460,7 @@ class BBRectangle : BBPath } BBPath::update(); + nodes.Free(); } } @@ -488,6 +499,7 @@ class BBCircle : BBPath } BBPath::update(); + nodes.Free(); } } @@ -528,5 +540,6 @@ class BBEllipse : BBPath } BBPath::update(); + nodes.Free(); } }