Bug 32428

Summary: [Qt] ImageDecoderQt fails to provide image file extensions
Product: WebKit Reporter: Andreas Kling <kling>
Component: WebKit QtAssignee: Andreas Kling <kling>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, hausmann, webkit.review.bot, zecke
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
Retrieve the format immediately after creating the QImageReader none

Description Andreas Kling 2009-12-11 05:38:17 PST
QImageReader only allows retrieving the format() before having read the image.

(See http://doc.trolltech.com/4.6/qimagereader.html#format for more information.)

The most obvious symptom of this bug is a failing assertion when attempting to click-and-drag an image:

ASSERTION FAILED: !image->filenameExtension().isEmpty()
(../../../WebCore/page/DragController.cpp:675 bool WebCore::DragController::startDrag(WebCore::Frame*, WebCore::Clipboard*, WebCore::DragOperation, const WebCore::PlatformMouseEvent&, const WebCore::IntPoint&, bool))
Comment 1 Andreas Kling 2009-12-11 06:11:53 PST
Created attachment 44680 [details]
Retrieve the format immediately after creating the QImageReader
Comment 2 WebKit Review Bot 2009-12-11 06:12:36 PST
style-queue ran check-webkit-style on attachment 44680 [details] without any errors.
Comment 3 Simon Hausmann 2009-12-11 06:28:26 PST
Comment on attachment 44680 [details]
Retrieve the format immediately after creating the QImageReader

r=me

Holger, would be great if you could double-check it, too. But from all I can see this seems like a safe thing to do. Calling format() will only initialize the handler (which we need to do anyway), but otherwise retrieving the format doesn't trigger any of the expensive decoding work.

We _could_ also do the initHandler() part on demand. But right now this patch seems safe and it fixes a failing assertion (crash) in the DragController when dragging images. (the assertion being that the format must be non-empty)
Comment 4 WebKit Commit Bot 2009-12-11 06:38:46 PST
Comment on attachment 44680 [details]
Retrieve the format immediately after creating the QImageReader

Clearing flags on attachment: 44680

Committed r51983: <http://trac.webkit.org/changeset/51983>
Comment 5 WebKit Commit Bot 2009-12-11 06:39:00 PST
All reviewed patches have been landed.  Closing bug.