<div dir="ltr">Another solution is to not close the device inside the close method of KArchive (when the device is not owned).<br><br> if (d->dev && d->dev != d->saveFile) {<br> d->dev->close();<br> }<br><br>should be:<br><br> if (d->deviceOwned && d->dev && d->dev != d->saveFile) {<br> d->dev->close();<br> }<br><br>Keep in mind that i dodn't test this approach and i don't know if this is correct nor the implications that this change could have to other applications.<br><br>More ideas?<br><div><div class="gmail_extra"><br><div class="gmail_quote">2015-10-17 19:18 GMT+02:00 Juan Palacios <span dir="ltr"><<a href="mailto:jpalaciosdev@gmail.com" target="_blank">jpalaciosdev@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><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" target="_blank">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>
</blockquote></div><br></div></div></div>