Bug 107161 - imageSmoothingEnabled frequent, unpredictable crashes
Summary: imageSmoothingEnabled frequent, unpredictable crashes
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Canvas (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Major
Assignee: sugoi
URL: http://worldhack.github.com/chromecan...
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-17 12:46 PST by sugoi
Modified: 2013-02-01 12:51 PST (History)
4 users (show)

See Also:


Attachments
Patch (3.43 KB, patch)
2013-01-17 12:57 PST, sugoi
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description sugoi 2013-01-17 12:46:43 PST
Visit the URL to reproduce the crash.

This crash was found in chrome :
http://code.google.com/p/chromium/issues/detail?id=166100
Comment 1 sugoi 2013-01-17 12:57:03 PST
Created attachment 183249 [details]
Patch
Comment 2 Stephen White 2013-01-17 13:25:59 PST
Comment on attachment 183249 [details]
Patch

Looks good.  r=me
Comment 3 WebKit Review Bot 2013-01-17 15:18:51 PST
Comment on attachment 183249 [details]
Patch

Clearing flags on attachment: 183249

Committed r140057: <http://trac.webkit.org/changeset/140057>
Comment 4 WebKit Review Bot 2013-01-17 15:18:54 PST
All reviewed patches have been landed.  Closing bug.
Comment 5 Alexey Proskuryakov 2013-01-18 10:53:59 PST
Comment on attachment 183249 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=183249&action=review

> Source/WebCore/ChangeLog:3
> +        imageSmoothingEnabled frequent, unpredictable crashes

This bug title implies that the issue is mysterious and unreproducible. But there is a test case, so the issue in in fact well understood.

The right thing to do would be to re-title the bug to explain what exactly is being fixed, and to use the new title in ChangeLog too.

> Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp:2403
> +    GraphicsContext* c = drawingContext();
> +    if (c)
> +        c->setImageInterpolationQuality(enabled ? DefaultInterpolationQuality : InterpolationNone);

A slightly better way to write this (and how we usually do it in WebKit) would be:

    if (GraphicsContext* context = drawingContext())
        context->setImageInterpolationQuality(enabled ? DefaultInterpolationQuality : InterpolationNone);

Using "c" as variable name is particularly against WebKit coding culture.

> LayoutTests/fast/canvas/canvas-imageSmoothingEnabled-zero-size.html:1
> +

This blank line doesn't make a technical difference, but is surprising.
Comment 6 sugoi 2013-01-18 11:12:35 PST
> > Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp:2403
> > +    GraphicsContext* c = drawingContext();
> > +    if (c)
> > +        c->setImageInterpolationQuality(enabled ? DefaultInterpolationQuality : InterpolationNone);
> 
> A slightly better way to write this (and how we usually do it in WebKit) would be:
> 
>     if (GraphicsContext* context = drawingContext())
>         context->setImageInterpolationQuality(enabled ? DefaultInterpolationQuality : InterpolationNone);
> 
> Using "c" as variable name is particularly against WebKit coding culture.

Really ? Because, in that file, I counted this line 40 times :
GraphicsContext* c = drawingContext();
And not a single time is it declared within the if() statement. I was actually trying to keep the style of the file I was working in.
Comment 7 Benjamin Poulain 2013-02-01 12:51:38 PST
> Really ? Because, in that file, I counted this line 40 times :
> GraphicsContext* c = drawingContext();
> And not a single time is it declared within the if() statement. I was actually trying to keep the style of the file I was working in.

Past mistake are no excuses to avoid doing a good job.

I completely agree with Alexey. The ChangeLog is poor and the code should have been better.