Missing icons on all kde apps

Boudewijn Rempt boud at valdyas.org
Sun Oct 18 14:12:06 UTC 2015


Hi Juan,

That really is awesome detective work. I think the best option would be to both have the peek() inside the kra/ora code and discuss whether changing karchive makes sense on frameworks-devel.

Boudewijn

-- 
Boudewijn Rempt | http://www.krita.org, http://www.valdyas.org

On Sat, 17 Oct 2015, Juan Palacios wrote:

> Another solution is to not close the device inside the close method of KArchive (when the device is not owned).
> 
>     if (d->dev && d->dev != d->saveFile) {
>         d->dev->close();
>     }
> 
> should be:
> 
>     if (d->deviceOwned && d->dev && d->dev != d->saveFile) {
>         d->dev->close();
>     }
> 
> 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.
> 
> More ideas?
> 
> 2015-10-17 19:18 GMT+02:00 Juan Palacios <jpalaciosdev at gmail.com>:
>       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: https://bugs.kde.org/show_bug.cgi?id=352891)
>
>       I found that this bug is caused by the QImageIOPlugin to support kra and ora formats (located on inst/lib64/plugins/).
>
>       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.
>
>       There are two ways to solve this problem:
>       The first one reopens the device at the end of capabilities method, but this can change the device state (read/write positions ...).
>
>       Example for OraPlugin::capabilities(QIODevice *device, const QByteArray &format) const
>
>           ...
>
>           const QIODevice::OpenMode mode = device->openMode();
>
>           Capabilities cap;
>           if (device->isReadable() && OraHandler::canRead(device)) {
>               cap |= CanRead;
>           }
>
>           if (!device->isOpen())
>               device->open(mode);
>
>           ...
> 
>
>       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.
>
>       Example:
>       bool OraHandler::canRead(QIODevice *device)
>       {
>           if (!device) {
>               qWarning("KraHandler::canRead() called with no device");
>               return false;
>           }
>
>           char buff[54];
>           if (device->peek(buff, sizeof(buff)) == sizeof(buff))
>               return qstrcmp(buff + 0x26, "image/openraster") == 0;
>
>           return false;
>       }
> 
>
>       I already tested both fixes and seems to solve the problem.
>       Thoughts on this?
> 
> 
> 
>


More information about the kimageshop mailing list