<@U23GH6RGS> I'm looking for a more automated appr...
# kotlin-native
i
@nish I'm looking for a more automated approach, so that when the high-level wrapper goes out of scope/gets deleted, it automatically unrefs/frees the gobject CPointer. Objects could potentially be long-lived as well (assigned to properties, for example), and could outlive a simple scoped block.
t
What about something like
this.myThing = wrappedLibrary.objectA.objectB.objectC.objectD.theThing
when accessing a foreign object system from Kotlin, e.g. GObject, COM, Python, ...? You would want all the intermediate wrapped objects (
objectA
,
objectB
, ...) destroyed as soon as possible (perhaps scoped to the block) but
theThing
to be left alive.