mirror of https://github.com/status-im/nim-eth.git
Don't use destructors
This commit is contained in:
parent
ce5f6e4c1f
commit
345dac702b
|
@ -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 =
|
||||||
|
|
Loading…
Reference in New Issue