From 753d2cafa5a475477a56d97f658a914c1aa2d1b3 Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Wed, 24 Jan 2007 16:24:47 +0000 Subject: [PATCH] compile fix: std::exception does only have a default constructor, the other constrcutor is non-standard. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16835 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/support/ExceptionMessage.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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