From 385cfd5420db55803e876150c0c4bcdcae014f12 Mon Sep 17 00:00:00 2001 From: Ferdinand Majerech Date: Wed, 3 Jun 2015 21:04:15 +0200 Subject: [PATCH] If we create a File instance, be sure to destroy it. --- source/dyaml/dumper.d | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/dyaml/dumper.d b/source/dyaml/dumper.d index be7be95..5fe4c6b 100644 --- a/source/dyaml/dumper.d +++ b/source/dyaml/dumper.d @@ -164,6 +164,8 @@ struct Dumper throw new YAMLException("Unable to open file " ~ filename ~ " for YAML dumping: " ~ e.msg); } + // need to destroy the File we constructed. + weOwnStream_ = true; } ///Construct a Dumper writing to a _stream. This is useful to e.g. write to memory. @@ -175,9 +177,10 @@ struct Dumper } ///Destroy the Dumper. - pure @safe nothrow ~this() + @trusted ~this() { YAMLVersion_ = null; + if(weOwnStream_) { destroy(stream_); } } ///Set stream _name. Used in debugging messages.