From 6fcf38217e8772b2f90c7a8e7ce6b60071f6d20c Mon Sep 17 00:00:00 2001 From: Steven Bennetts Date: Tue, 25 Mar 2008 22:50:26 +0000 Subject: merge release@82858 maint-render-2-merge@83010 -> release QAR-389 --- indra/llcommon/llfile.cpp | 8 ++++++-- indra/llcommon/llfile.h | 6 ++++-- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llfile.cpp b/indra/llcommon/llfile.cpp index c44650009d..3c590a0d49 100644 --- a/indra/llcommon/llfile.cpp +++ b/indra/llcommon/llfile.cpp @@ -266,6 +266,7 @@ void llofstream::open(const char* _Filename, /* Flawfinder: ignore */ } llassert(_Filebuffer==NULL); _Filebuffer = new _Myfb(filep); + _ShouldClose = true; _Myios::init(_Filebuffer); } @@ -281,7 +282,7 @@ void llofstream::close() llofstream::llofstream(const char *_Filename, std::ios_base::openmode _Mode, int _Prot) - : std::basic_ostream >(NULL,true),_Filebuffer(NULL) + : std::basic_ostream >(NULL,true),_Filebuffer(NULL),_ShouldClose(false) { // construct with named file and specified mode open(_Filename, _Mode , _Prot); /* Flawfinder: ignore */ } @@ -289,7 +290,10 @@ llofstream::llofstream(const char *_Filename, llofstream::~llofstream() { // destroy the object - close(); + if (_ShouldClose) + { + close(); + } delete _Filebuffer; } diff --git a/indra/llcommon/llfile.h b/indra/llcommon/llfile.h index 7a1542a6fa..da1ad6a34e 100644 --- a/indra/llcommon/llfile.h +++ b/indra/llcommon/llfile.h @@ -127,7 +127,7 @@ public: typedef std::basic_ios > _Myios; llofstream() - : std::basic_ostream >(NULL,true),_Filebuffer(NULL) + : std::basic_ostream >(NULL,true),_Filebuffer(NULL),_ShouldClose(false) { // construct unopened } @@ -138,7 +138,8 @@ public: explicit llofstream(_Filet *_File) : std::basic_ostream >(NULL,true), - _Filebuffer(new _Myfb(_File))//_File) + _Filebuffer(new _Myfb(_File)),//_File) + _ShouldClose(false) { // construct with specified C stream } @@ -157,6 +158,7 @@ public: private: _Myfb *_Filebuffer; // the file buffer + bool _ShouldClose; }; -- cgit v1.2.3