[Development] Can QImage format plugins require QGuiApplication?

Kevin Kofler kevin.kofler at chello.at
Mon Apr 13 18:50:17 CEST 2020


Hi,

I have a question concerning development of plugins for Qt, so hopefully it 
is not entirely off-topic here:

Today, a user on #fedora-kde ran across a crash which resulted from:
* a GTK+/GNOME application (Jami) using (for some reason) QImage to load
  images, without a QGuiApplication or QApplication constructed, vs.
* a QImage format plugin (QtPBFImagePlugin) using font APIs that require
  QGuiApplication and abort otherwise.

Obviously, one or the other must be wrong. So, who is to blame?

There is also an additional issue, in that the plugin's check for supported 
images is too broad, which leads to it getting (wrongly) automatically 
chosen in the first place and triggering the conflict. We have already 
reported that one as a bug, because in that case, it is clear who is at 
fault:
https://github.com/tumic0/QtPBFImagePlugin/issues/6
but I do not know whom to blame for the other issue.

I have looked at the documentation, but I was not able to find a definite 
answer to my question there either. I see that, e.g., 
QImageReader::supportedImageFormats() is documented as requiring 
QApplication, but I do not know whether that is relevant here.

        Kevin Kofler



More information about the Development mailing list