From 657c67fcf4fc104212c84ca71edd09e69a476364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20W=C3=A4ckerlin?= Date: Wed, 14 Nov 2018 11:01:08 +0100 Subject: [PATCH] show correct exceptions: fix exception memory access bug --- src/exceptions.hxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; };