show correct exceptions: fix exception memory access bug

master
Marc Wäckerlin 6 years ago
parent 657c67fcf4
commit 7c7786eb04
  1. 2
      COPYING
  2. 2
      INSTALL
  3. 6
      src/exceptions.hxx

@ -1 +1 @@
/usr/share/automake-1.13/COPYING /usr/share/automake-1.15/COPYING

@ -1 +1 @@
/usr/share/automake-1.13/INSTALL /usr/share/automake-1.15/INSTALL

@ -16,8 +16,9 @@ class Exception: public std::exception {
Exception(QString w): _what(w) {} Exception(QString w): _what(w) {}
~Exception() throw() {} ~Exception() throw() {}
const char* what() const throw() { const char* what() const throw() {
_bytes = _what.toUtf8(); static QByteArray bytes;
return _bytes.data(); bytes = _what.toUtf8();
return bytes.data();
} }
void line(int linenr) { void line(int linenr) {
if (linenr>0) _what=QString::number(linenr)+" "+_what; if (linenr>0) _what=QString::number(linenr)+" "+_what;
@ -26,7 +27,6 @@ class Exception: public std::exception {
if (filename.size()) _what=filename+":"+_what; if (filename.size()) _what=filename+":"+_what;
} }
protected: protected:
QByteArray _bytes;
QString _what; QString _what;
}; };

Loading…
Cancel
Save