Members of the KDE Community are recommended to subscribe to the kde-community mailing list at to allow them to participate in important discussions and receive other important announcements

Commit 4530c07c authored by Albert Astals Cid's avatar Albert Astals Cid

gs thumbnailer: Make it work when gs spits out warning messages

BUGS: 388288

Reviewers: #kde_applications, #dolphin, elvisangelaccio

Reviewed By: elvisangelaccio

Subscribers: elvisangelaccio, ngraham

Differential Revision:
parent c12af131
......@@ -447,7 +447,18 @@ bool GSCreator::create(const QString &path, int width, int height, QImage &img)
int l = img.loadFromData( data );
bool loaded = img.loadFromData( data );
if (!loaded) {
// Sometimes gs spits some warning messages before the actual image
// try to skip them
const QByteArray pngHeader = "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A";
const int pngMarkerIndex = data.indexOf(pngHeader);
if (pngMarkerIndex > 0) {
data = data.mid(pngMarkerIndex);
loaded = img.loadFromData( data );
if ( got_sig_term &&
oldhandler != SIG_ERR &&
......@@ -457,7 +468,7 @@ bool GSCreator::create(const QString &path, int width, int height, QImage &img)
if ( oldhandler != SIG_ERR ) signal( SIGTERM, oldhandler );
return ok && l;
return ok && loaded;
ThumbCreator::Flags GSCreator::flags() const
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment