diff --git a/src/solid/devices/backends/udisks2/udisksdevicebackend.cpp b/src/solid/devices/backends/udisks2/udisksdevicebackend.cpp --- a/src/solid/devices/backends/udisks2/udisksdevicebackend.cpp +++ b/src/solid/devices/backends/udisks2/udisksdevicebackend.cpp @@ -22,9 +22,9 @@ #include "udisksdevicebackend.h" +#include #include #include -#include #include "solid/deviceinterface.h" #include "solid/genericinterface.h" @@ -95,16 +95,14 @@ return; } - QDomDocument dom; - dom.setContent(xmlData); - - QDomNodeList ifaceNodeList = dom.elementsByTagName("interface"); - for (int i = 0; i < ifaceNodeList.count(); i++) { - QDomElement ifaceElem = ifaceNodeList.item(i).toElement(); - /* Accept only org.freedesktop.UDisks2.* interfaces so that when the device is unplugged, - * m_interfaces goes empty and we can easily verify that the device is gone. */ - if (!ifaceElem.isNull() && ifaceElem.attribute("name").startsWith(UD2_DBUS_SERVICE)) { - m_interfaces.append(ifaceElem.attribute("name")); + QXmlStreamReader xml(xmlData); + while (!xml.atEnd()) { + xml.readNext(); + if (xml.isStartElement() && xml.name() == QLatin1String("interface")) { + const auto name = xml.attributes().value(QLatin1String("name")).toString(); + if (name.startsWith(UD2_DBUS_SERVICE)) { + m_interfaces.append(name); + } } }