use

fun <T : KGObject, O> T.use(block: (T) -> O): O

Use a KGObject, then unref, finally return the result