diff options
Diffstat (limited to 'cppe/src/IceE/ExceptionBase.cpp')
-rwxr-xr-x | cppe/src/IceE/ExceptionBase.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/cppe/src/IceE/ExceptionBase.cpp b/cppe/src/IceE/ExceptionBase.cpp index dd8e5979609..22c4ea4f4cc 100755 --- a/cppe/src/IceE/ExceptionBase.cpp +++ b/cppe/src/IceE/ExceptionBase.cpp @@ -9,6 +9,7 @@ #include <IceE/Exception.h> #include <IceE/SafeStdio.h> +#include <IceE/StaticMutex.h> using namespace std; @@ -49,12 +50,25 @@ IceUtil::Exception::toString() const string out; if(_file && _line > 0) { - out += Ice::printfToString("%s:%d: ", _file, _line); + out += Ice::printfToString("%s:%d: ", _file, _line); } out += ice_name(); return out; } +const char* +IceUtil::Exception::what() const throw() +{ + StaticMutex::Lock lock(globalMutex); + { + if(_str.empty()) + { + _str = toString(); // Lazy initialization. + } + } + return _str.c_str(); +} + IceUtil::Exception* IceUtil::Exception::ice_clone() const { |