diff options
author | Aapo Haapanen <aapo.haapanen@nokia.com> | 2011-09-22 15:50:50 +0300 |
---|---|---|
committer | Aapo Haapanen <aapo.haapanen@nokia.com> | 2011-09-23 15:19:08 +0300 |
commit | 00a3147f66688b71069989bbac406a00f6e8cf83 (patch) | |
tree | 29221eaa7b6021002e6ac0596a526a0c9fd8b800 /src/xmlpatterns | |
parent | b0fbf9dae591dc839e14a087c1d69189e3fe9461 (diff) |
Fix for QTBUG-18050: QXmlQuery crash
If QXmlQuery has a previous focus and an invalid xml is given
in setFocus, the old focus must be cleared. Otherwise the query
may be left in an inconsistent state.
Task-number: QTBUG-18050
Reviewed-by: Miikka Heikkinen
Diffstat (limited to 'src/xmlpatterns')
-rw-r--r-- | src/xmlpatterns/api/qxmlquery.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/xmlpatterns/api/qxmlquery.cpp b/src/xmlpatterns/api/qxmlquery.cpp index e69fe508d8..e5e901d315 100644 --- a/src/xmlpatterns/api/qxmlquery.cpp +++ b/src/xmlpatterns/api/qxmlquery.cpp @@ -988,7 +988,12 @@ bool setFocusHelper(QXmlQuery *const queryInstance, const QXmlItem focusItem(focusResult.next()); if(focusItem.isNull() || focusResult.hasError()) + { + /* The previous focus must be cleared in error situations. + * Otherwise the query may be left in an inconsistent state. */ + queryInstance->setFocus(QXmlItem()); return false; + } else { queryInstance->setFocus(focusItem); |