X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fsupport%2FExceptionMessage.h;h=9b752be029e5351d73ebf675e01b913fd2c6502b;hb=848c89564fce9c4bfec79b915746dc6bc47abc3d;hp=dc597c6547cf6d97ac69fc8e8d9bfbeff27b123a;hpb=801f807063eb97c381812fd4d452fd0662b23459;p=lyx.git diff --git a/src/support/ExceptionMessage.h b/src/support/ExceptionMessage.h index dc597c6547..9b752be029 100644 --- a/src/support/ExceptionMessage.h +++ b/src/support/ExceptionMessage.h @@ -33,14 +33,17 @@ class ExceptionMessage: public std::exception { public: ExceptionMessage(ExceptionType type, docstring const & title, docstring const & details) - : exception((to_utf8(title) + "\n" + to_utf8(details)).c_str()), - type_(type), title_(title), details_(details) {} + : type_(type), title_(title), details_(details), + message_(to_utf8(title_ + '\n' + details_)) {} - virtual ~ExceptionMessage() {} + virtual const char * what() const throw() { return message_.c_str(); } + virtual ~ExceptionMessage() throw() {} ExceptionType type_; docstring title_; docstring details_; + // Needed because we may not return a temporary in what(). + std::string message_; }; } // namespace support