If we create a File instance, be sure to destroy it.

This commit is contained in:
Ferdinand Majerech 2015-06-03 21:04:15 +02:00
parent 96f64eb221
commit 385cfd5420

View file

@ -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.