full destructor support for ARC
This commit is contained in:
parent
2628663637
commit
ec7b8a7760
7 changed files with 330 additions and 131 deletions
|
|
@ -5,6 +5,10 @@ type
|
|||
CountButton = ref object of Button
|
||||
counter: int
|
||||
|
||||
when compileOption("gc", "arc"):
|
||||
proc `=destroy`(x: var typeof(CountButton()[])) =
|
||||
gtk.`=destroy`(typeof(Button()[])(x))
|
||||
|
||||
proc buttonClicked (button: CountButton; decrement: int) =
|
||||
dec(button.counter, decrement)
|
||||
button.label = "Counter: " & $button.counter
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue