path: root/src/xml/sax/qxml.cpp
diff options
authorShane Kearns <>2011-11-10 17:16:25 +0000
committerQt by Nokia <>2011-11-11 02:45:05 +0100
commitd457f148cf1efbea3db5fdc87c418cc9647e2baf (patch)
treeac33641fad247deaa8eb70aee8f5797d0c081d48 /src/xml/sax/qxml.cpp
parent96611a677fc0feeb374c191e248842167f39770d (diff)
Fix warning when using QXmlInputSource with non opened QIODevice
Calling setTextModeEnabled on a QIODevice that is not open generates a warning as a result of QTBUG-20905. Previously, it caused incorrect behaviour when called with true. Now only call it if the QIODevice passed in is already opened. If not open, then it is opened by the xml reader without text mode, so there is no difference in behaviour. xml autotests still pass, although this removes several QWARN messages from the qdom autotest. Task-number: QTBUG-22659 Change-Id: Ie3137e44fe776bff6371ebd008428110168717ec Reviewed-by: João Abecasis <>
Diffstat (limited to 'src/xml/sax/qxml.cpp')
1 files changed, 2 insertions, 1 deletions
diff --git a/src/xml/sax/qxml.cpp b/src/xml/sax/qxml.cpp
index 671adafcbd..067731bb67 100644
--- a/src/xml/sax/qxml.cpp
+++ b/src/xml/sax/qxml.cpp
@@ -1321,7 +1321,8 @@ QXmlInputSource::QXmlInputSource(QIODevice *dev)
d->inputDevice = dev;
- d->inputDevice->setTextModeEnabled(false);
+ if (dev->isOpen())
+ d->inputDevice->setTextModeEnabled(false);