fix memory leak by adding Free on font surface

This commit is contained in:
cuu
2019-05-06 00:01:12 +08:00
parent 8377acd017
commit d26152e14f
9 changed files with 22 additions and 7 deletions

View File

@@ -126,6 +126,7 @@ func (self *Textarea) BuildBlitText() {
linenumber += 1
blit_rows = append(blit_rows,[]string{})
}
t.Free()
}
if len(blit_rows) == 1 {
@@ -182,7 +183,7 @@ func (self *Textarea) BlitText() {
rect_ := rect.Rect(x,y,0,0)
surface.Blit(self.CanvasHWND,t,&rect_,nil)
x += surface.GetWidth(t)
t.Free()
}
}
@@ -210,11 +211,13 @@ func (self *Textarea) Cursor() {
break
}
x += surface.GetWidth(t)
t.Free()
}
c_t := font.Render(self.FontObj,"_",true,&color.Color{0,0,0,255},nil)
rect_ := rect.Rect(x+1,y-2,0,0)
surface.Blit(self.CanvasHWND,c_t,&rect_,nil)
c_t.Free()
}
func (self *Textarea) Draw() {