Don't use destructors

This commit is contained in:
Zahary Karadjov 2020-10-16 19:50:01 +03:00 committed by zah
parent ce5f6e4c1f
commit 345dac702b
1 changed files with 2 additions and 1 deletions

View File

@ -42,7 +42,7 @@ proc release[T](x: var AutoDisposed[T]): T =
result = x.val result = x.val
x.val = nil x.val = nil
proc `=destroy`*[T](x: var AutoDisposed[T]) = proc disposeIfUnreleased[T](x: var AutoDisposed[T]) =
mixin dispose mixin dispose
if x.val != nil: if x.val != nil:
dispose(x.release) dispose(x.release)
@ -299,6 +299,7 @@ proc init*(
inMemory = false, inMemory = false,
keyspaces: openarray[string] = ["kvstore"]): KvResult[T] = keyspaces: openarray[string] = ["kvstore"]): KvResult[T] =
var env: AutoDisposed[ptr sqlite3] var env: AutoDisposed[ptr sqlite3]
defer: disposeIfUnreleased(env)
let let
name = name =