summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
authorSteven Bennetts <steve@lindenlab.com>2008-03-25 22:50:26 +0000
committerSteven Bennetts <steve@lindenlab.com>2008-03-25 22:50:26 +0000
commit6fcf38217e8772b2f90c7a8e7ce6b60071f6d20c (patch)
treea8e35fe195cc86c616daf9d8a21571e04bc2bc35 /indra/llcommon
parent11a3589665aae1a2423e258e40eba45c117627d5 (diff)
merge release@82858 maint-render-2-merge@83010 -> release
QAR-389
Diffstat (limited to 'indra/llcommon')
-rw-r--r--indra/llcommon/llfile.cpp8
-rw-r--r--indra/llcommon/llfile.h6
2 files changed, 10 insertions, 4 deletions
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<char,std::char_traits < char > >(NULL,true),_Filebuffer(NULL)
+ : std::basic_ostream<char,std::char_traits < char > >(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<char,std::char_traits < char > > _Myios;
llofstream()
- : std::basic_ostream<char,std::char_traits < char > >(NULL,true),_Filebuffer(NULL)
+ : std::basic_ostream<char,std::char_traits < char > >(NULL,true),_Filebuffer(NULL),_ShouldClose(false)
{ // construct unopened
}
@@ -138,7 +138,8 @@ public:
explicit llofstream(_Filet *_File)
: std::basic_ostream<char,std::char_traits < char > >(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;
};