mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2025-06-03 17:08:08 -04:00
[EPS] Fix crash at app shutdown (being tried to persist clipboard image)
Summary: Deny any capabilities when there is no QApp instance. BUG: 397040 Test Plan: Untested, as I do not experience the bug on my system and had no time to invest into trying to. Reviewers: zccrs, dfaure, pino Reviewed By: dfaure Subscribers: kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D15405
This commit is contained in:
parent
167967a145
commit
98c65a438d
@ -14,6 +14,7 @@
|
|||||||
#include <QPrinter>
|
#include <QPrinter>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QTemporaryFile>
|
#include <QTemporaryFile>
|
||||||
|
#include <QCoreApplication>
|
||||||
|
|
||||||
// logging category for this framework, default: log stuff >= warning
|
// logging category for this framework, default: log stuff >= warning
|
||||||
Q_LOGGING_CATEGORY(EPSPLUGIN, "epsplugin", QtWarningMsg)
|
Q_LOGGING_CATEGORY(EPSPLUGIN, "epsplugin", QtWarningMsg)
|
||||||
@ -333,6 +334,15 @@ bool EPSHandler::canRead(QIODevice *device)
|
|||||||
|
|
||||||
QImageIOPlugin::Capabilities EPSPlugin::capabilities(QIODevice *device, const QByteArray &format) const
|
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") {
|
if (format == "eps" || format == "epsi" || format == "epsf") {
|
||||||
return Capabilities(CanRead | CanWrite);
|
return Capabilities(CanRead | CanWrite);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user