Don't use destructors
This commit is contained in:
parent
f3d1c8883f
commit
caab5c917f
2 changed files with 12 additions and 0 deletions
|
|
@ -65,6 +65,11 @@ proc close*(s: InputStream) {.raises: [IOError, Defect].} =
|
||||||
|
|
||||||
s.preventFurtherReading()
|
s.preventFurtherReading()
|
||||||
|
|
||||||
|
# TODO
|
||||||
|
# The destructors are currently disabled because they seem to cause
|
||||||
|
# mysterious segmentation faults related to corrupted GC internal
|
||||||
|
# data structures.
|
||||||
|
#[
|
||||||
proc `=destroy`*(h: var InputStreamHandle) {.raises: [Defect].} =
|
proc `=destroy`*(h: var InputStreamHandle) {.raises: [Defect].} =
|
||||||
if h.s != nil:
|
if h.s != nil:
|
||||||
if h.s.vtable != nil and h.s.vtable.closeSync != nil:
|
if h.s.vtable != nil and h.s.vtable.closeSync != nil:
|
||||||
|
|
@ -82,6 +87,7 @@ proc `=destroy`*(h: var InputStreamHandle) {.raises: [Defect].} =
|
||||||
# We work-around the problem through more indirect incapacitatation
|
# We work-around the problem through more indirect incapacitatation
|
||||||
# of the stream object:
|
# of the stream object:
|
||||||
h.s.preventFurtherReading()
|
h.s.preventFurtherReading()
|
||||||
|
]#
|
||||||
|
|
||||||
converter implicitDeref*(h: InputStreamHandle): InputStream =
|
converter implicitDeref*(h: InputStreamHandle): InputStream =
|
||||||
h.s
|
h.s
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,11 @@ proc close*(s: OutputStream) {.raises: [IOError, Defect].} =
|
||||||
if s.vtable != nil and s.vtable.closeSync != nil:
|
if s.vtable != nil and s.vtable.closeSync != nil:
|
||||||
s.vtable.closeSync(s)
|
s.vtable.closeSync(s)
|
||||||
|
|
||||||
|
# TODO
|
||||||
|
# The destructors are currently disabled because they seem to cause
|
||||||
|
# mysterious segmentation faults related to corrupted GC internal
|
||||||
|
# data structures.
|
||||||
|
#[
|
||||||
proc `=destroy`*(h: var OutputStreamHandle) {.raises: [Defect].} =
|
proc `=destroy`*(h: var OutputStreamHandle) {.raises: [Defect].} =
|
||||||
if h.s != nil:
|
if h.s != nil:
|
||||||
if h.s.vtable != nil and h.s.vtable.closeSync != nil:
|
if h.s.vtable != nil and h.s.vtable.closeSync != nil:
|
||||||
|
|
@ -83,6 +88,7 @@ proc `=destroy`*(h: var OutputStreamHandle) {.raises: [Defect].} =
|
||||||
# `close` manually.
|
# `close` manually.
|
||||||
discard # TODO
|
discard # TODO
|
||||||
# h.s = nil
|
# h.s = nil
|
||||||
|
]#
|
||||||
|
|
||||||
converter implicitDeref*(h: OutputStreamHandle): OutputStream =
|
converter implicitDeref*(h: OutputStreamHandle): OutputStream =
|
||||||
h.s
|
h.s
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue