show correct exceptions: fix exception memory access bug
This commit is contained in:
@@ -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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user