diff options
author | Volker Hilsheimer <volker.hilsheimer@nokia.com> | 2009-07-28 16:16:36 (GMT) |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@nokia.com> | 2009-07-28 16:16:36 (GMT) |
commit | 5c11a736367a854c3c201c31265f96e8153f20f5 (patch) | |
tree | ad8b742c3738886e8083d27130b538a7048d6520 /src | |
parent | b5bcc529f67458c98571d3b726c9d173512aac27 (diff) | |
download | Qt-5c11a736367a854c3c201c31265f96e8153f20f5.zip Qt-5c11a736367a854c3c201c31265f96e8153f20f5.tar.gz Qt-5c11a736367a854c3c201c31265f96e8153f20f5.tar.bz2 |
Implement a copy constructor for QXmlParseException to avoid crashes when
throwing them.
Autotest included.
Task: 258081
Reviewed-by: Trustme
Diffstat (limited to 'src')
-rw-r--r-- | src/xml/sax/qxml.cpp | 18 | ||||
-rw-r--r-- | src/xml/sax/qxml.h | 1 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/xml/sax/qxml.cpp b/src/xml/sax/qxml.cpp index fe1e740..3b1726b 100644 --- a/src/xml/sax/qxml.cpp +++ b/src/xml/sax/qxml.cpp @@ -244,6 +244,16 @@ public: class QXmlParseExceptionPrivate { public: + QXmlParseExceptionPrivate() + : column(-1), line(-1) + { + } + QXmlParseExceptionPrivate(const QXmlParseExceptionPrivate &other) + : msg(other.msg), column(other.column), line(other.line), + pub(other.pub), sys(other.sys) + { + } + QString msg; int column; int line; @@ -553,6 +563,14 @@ QXmlParseException::QXmlParseException(const QString& name, int c, int l, } /*! + Creates a copy of \a other. +*/ +QXmlParseException::QXmlParseException(const QXmlParseException& other) +{ + d = new QXmlParseExceptionPrivate(*other.d); +} + +/*! Destroys the QXmlParseException. */ QXmlParseException::~QXmlParseException() diff --git a/src/xml/sax/qxml.h b/src/xml/sax/qxml.h index 8aa7e63..6ccd44e 100644 --- a/src/xml/sax/qxml.h +++ b/src/xml/sax/qxml.h @@ -193,6 +193,7 @@ class Q_XML_EXPORT QXmlParseException public: explicit QXmlParseException(const QString &name = QString(), int c = -1, int l = -1, const QString &p = QString(), const QString &s = QString()); + QXmlParseException(const QXmlParseException &other); ~QXmlParseException(); int columnNumber() const; |