Missed contract in MayBeClosedReferenceCounter.withRef

This commit is contained in:
Andrew Golovashevich 2025-08-13 15:58:11 +03:00
parent 1a26d61cd2
commit 8bf13d0f69

View File

@ -76,6 +76,9 @@ public sealed class MayBeClosedReferenceCounter {
@JvmName("withRef\$kt") @JvmName("withRef\$kt")
public inline fun <R> withRef(protected: () -> R): R { public inline fun <R> withRef(protected: () -> R): R {
contract {
callsInPlace(protected, InvocationKind.EXACTLY_ONCE)
}
this.incref() this.incref()
return safeAutoClose1(finally = this::decref, action = protected) return safeAutoClose1(finally = this::decref, action = protected)
} }