[bugfix] owned closures (#11544)
This commit is contained in:
parent
1a074fffa4
commit
c65a5d754b
11 changed files with 102 additions and 30 deletions
|
|
@ -2,7 +2,7 @@ discard """
|
|||
cmd: '''nim c --newruntime $file'''
|
||||
output: '''button
|
||||
clicked!
|
||||
3 3 alloc/dealloc pairs: 0'''
|
||||
6 6 alloc/dealloc pairs: 0'''
|
||||
"""
|
||||
|
||||
import core / allocators
|
||||
|
|
@ -52,8 +52,10 @@ proc main =
|
|||
|
||||
var b = newButton("button", nil)
|
||||
let u = unown b
|
||||
var clicked = "clicked"
|
||||
b.onclick = proc () =
|
||||
b.caption = "clicked!"
|
||||
clicked.add "!"
|
||||
u.caption = clicked
|
||||
w.add b
|
||||
|
||||
w.draw()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue