diff --git a/src/imageformats/eps.cpp b/src/imageformats/eps.cpp --- a/src/imageformats/eps.cpp +++ b/src/imageformats/eps.cpp @@ -14,6 +14,7 @@ #include #include #include +#include // logging category for this framework, default: log stuff >= warning Q_LOGGING_CATEGORY(EPSPLUGIN, "epsplugin", QtWarningMsg) @@ -333,6 +334,15 @@ QImageIOPlugin::Capabilities EPSPlugin::capabilities(QIODevice *device, const QByteArray &format) const { + // prevent bug #397040: when on app shutdown the clipboard content is to be copied to survive end of the app, + // QXcbIntegration looks for some QImageIOHandler to apply, querying the capabilities and picking any first. + // At that point this plugin no longer has its requirements e.g. to run the external process, so we have to deny. + // The capabilities seem to be queried on demand in Qt code and not cached, so it's fine to report based + // in current dynamic state + if (!QCoreApplication::instance()) { + return {}; + } + if (format == "eps" || format == "epsi" || format == "epsf") { return Capabilities(CanRead | CanWrite); }