memleak fix
This commit is contained in:
		| @@ -49,6 +49,7 @@ func (l *Level) Put (x, y int, tileFunc interface{}) { | ||||
|  | ||||
| func NewLevel(ctx util.ClientCtx, branch string, depth int) *Level { | ||||
| 	l := &Level{ | ||||
| 		ctx: ctx, | ||||
| 		Name:     branch + string(depth), | ||||
| 		Depth:    depth, | ||||
| 		Rect: types.NewRect(0,0, mapWidth, mapHeight), | ||||
|   | ||||
| @@ -21,6 +21,7 @@ func (g *GameState) Do(f func()) { | ||||
| 	done := make(chan struct{}, 1) | ||||
| 	g.Mainfunc <- func() { | ||||
| 		f() | ||||
| 		f = nil //zero pointer for closure function | ||||
| 		done <- struct{}{} | ||||
| 	} | ||||
| 	<-done | ||||
|   | ||||
		Reference in New Issue
	
	Block a user