<div dir="ltr">I have been having some problems with missing icons on all kde apps and the message QIODevice::seek (QBuffer): The device is not open on the terminal. (This bug report seems to be related with this issue: <a href="https://bugs.kde.org/show_bug.cgi?id=352891">https://bugs.kde.org/show_bug.cgi?id=352891</a>)<br><br>I found that this bug is caused by the QImageIOPlugin to support kra and ora formats (located on inst/lib64/plugins/).<br><br>KZip is used to read the contents of the file through the device on canRead(QIODevice *device) method. The problem is that KZip changes the state of the device (closes it on his destructor). QImageIOPlugin::capabilities documentation specifies that the device state should not be changed.<br><br>There are two ways to solve this problem:<br>The first one reopens the device at the end of capabilities method, but this can change the device state (read/write positions ...).<br><br>Example for OraPlugin::capabilities(QIODevice *device, const QByteArray &format) const<br><br>    ...<br><br>    const QIODevice::OpenMode mode = device->openMode();<br><br>    Capabilities cap;<br>    if (device->isReadable() && OraHandler::canRead(device)) {<br>        cap |= CanRead;<br>    }<br><br>    if (!device->isOpen())<br>        device->open(mode);<br><br>    ...<br><br><br>The other one is prone to future breaks if the kra or ora internals are changed in some way, but it will not change the device state. Consists in use device->peek method and extract the first 57 or 54 bytes (kra or ora), to obtain the "application/x-krita" and "image/openraster" directly.<br><br>Example:<br>bool OraHandler::canRead(QIODevice *device)<br>{<br>    if (!device) {<br>        qWarning("KraHandler::canRead() called with no device");<br>        return false;<br>    }<br><br>    char buff[54];<br>    if (device->peek(buff, sizeof(buff)) == sizeof(buff))<br>        return qstrcmp(buff + 0x26, "image/openraster") == 0;<br><br>    return false;<br>}<br><br><br>I already tested both fixes and seems to solve the problem.<br>Thoughts on this?<br></div>