Thanks for your reply.
I think I already tried something like
var cr1: sink cairo.Context
Run
but it does not compiled -- the reason may be that I do not yet understand sink
for local vars good enough.
But I just read your blog post about new runtime and owned refs more carefully,
and I got the impression that owned refs may be the perfect solution: We get
deterministic deallocation and keep the benefits of ref objects. And nearly no
code change will be necessary, only adding a few owned annotations. (I assume
that finalizers continue to work as they do now.)
PS:
For my comment from yesterday that getChild() or getParent() would not work too
nice currently, that should be wrong indeed. Gintro uses the gobject toggle_ref
mechanism, so getChild() gives us indeed a Widget, but it is the same Nim
object what we put into the container, so we can do Nim's of operator to test
what it really was, maybe a label or a button. So there is really an advantage
when we use ref objects for the proxy objects.
But: Will gc_ref() work at all with the new runtime? Currently gc_ref() is used
to keep the proxy object alive when a widget is put into a container, so that
we can recover the original Nim object from the gtk container. This may not
work without GC. So maybe we can use newruntime with owned refs only for the
cairo objects like surface and cairo_context, but that is OK, as Cairo is what
is critical for memory management. Widgets are in no way critical.