From 61d39f5c0d051eefc1672909cbcdb1fde57c61d1 Mon Sep 17 00:00:00 2001 From: Jerome St-Louis Date: Mon, 21 Sep 2015 00:55:32 +0900 Subject: [PATCH] Butterbur: Fixed double free, freeing VBO, freeing nodes --- butterbur/src/butterbur.ec | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) 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(); } } -- 1.8.3.1