From 26d0f59e650a0c125c8501978708e2d75618e1e7 Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Mon, 31 Mar 2014 13:56:41 +0000 Subject: [PATCH] fixed: exception getWhat usage returns garbage. --- src/lib/base/XBase.cpp | 3 ++- src/lib/base/XBase.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib/base/XBase.cpp b/src/lib/base/XBase.cpp index 123fb297..1c776bcd 100644 --- a/src/lib/base/XBase.cpp +++ b/src/lib/base/XBase.cpp @@ -48,7 +48,8 @@ XBase::what() const _NOEXCEPT { const char* what = std::runtime_error::what(); if (strlen(what) == 0) { - return getWhat().c_str(); + m_what = getWhat(); + return m_what.c_str(); } return what; } diff --git a/src/lib/base/XBase.h b/src/lib/base/XBase.h index 5e576aec..b3688436 100644 --- a/src/lib/base/XBase.h +++ b/src/lib/base/XBase.h @@ -48,6 +48,8 @@ protected: */ virtual CString format(const char* id, const char* defaultFormat, ...) const throw(); +private: + mutable CString m_what; }; /*!