From d0d4670f4941dcf7430fb1269c6613140ecf3ff7 Mon Sep 17 00:00:00 2001 From: Mark Lentczner Date: Tue, 6 Feb 2007 00:57:33 +0000 Subject: merge in of error-refactor-3 concludes (fixes) SL-31187 pair programmed and reviewed by markl and karen --- indra/llcommon/llfile.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'indra/llcommon/llfile.cpp') diff --git a/indra/llcommon/llfile.cpp b/indra/llcommon/llfile.cpp index 16e2f5c5a1..4acd94f943 100644 --- a/indra/llcommon/llfile.cpp +++ b/indra/llcommon/llfile.cpp @@ -178,6 +178,7 @@ void llifstream::open(const char* _Filename, /* Flawfinder: ignore */ } llassert(_Filebuffer == NULL); _Filebuffer = new _Myfb(filep); + _ShouldClose = true; _Myios::init(_Filebuffer); } @@ -189,13 +190,17 @@ bool llifstream::is_open() const } llifstream::~llifstream() { + if (_ShouldClose) + { + close(); + } delete _Filebuffer; } llifstream::llifstream(const char *_Filename, ios_base::openmode _Mode, int _Prot) - : std::basic_istream< char , std::char_traits< char > >(NULL,true),_Filebuffer(NULL) + : std::basic_istream< char , std::char_traits< char > >(NULL,true),_Filebuffer(NULL),_ShouldClose(false) { // construct with named file and specified mode open(_Filename, _Mode | ios_base::in, _Prot); /* Flawfinder: ignore */ -- cgit v1.2.3