diff --git a/src/exceptions.hxx b/src/exceptions.hxx index 7de757e..e1bfd49 100644 --- a/src/exceptions.hxx +++ b/src/exceptions.hxx @@ -16,7 +16,8 @@ class Exception: public std::exception { Exception(QString w): _what(w) {} ~Exception() throw() {} const char* what() const throw() { - return _what.toStdString().c_str(); + _bytes = _what.toUtf8(); + return _bytes.data(); } void line(int linenr) { if (linenr>0) _what=QString::number(linenr)+" "+_what; @@ -25,6 +26,7 @@ class Exception: public std::exception { if (filename.size()) _what=filename+":"+_what; } protected: + QByteArray _bytes; QString _what; };