Bug 99122 - LocalCurrentGraphicsContext will never restore the current context to null
Summary: LocalCurrentGraphicsContext will never restore the current context to null
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Tim Horton
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-11 17:40 PDT by Tim Horton
Modified: 2012-10-11 18:29 PDT (History)
2 users (show)

See Also:


Attachments
patch (3.28 KB, patch)
2012-10-11 18:21 PDT, Tim Horton
simon.fraser: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Horton 2012-10-11 17:40:16 PDT
In a WebKit2 world, at rest, we are in a state where NSGraphicsContext is null (because we have no NSWindow, NSViews, etc.)

LocalCurrentGraphicsContext is supposed to make temporary changes to the current Cocoa graphics context. However! It will not restore the current context to null, so you can end up with an unexpected context as the "at rest" context.
Comment 1 Tim Horton 2012-10-11 18:21:44 PDT
Created attachment 168327 [details]
patch
Comment 2 Simon Fraser (smfr) 2012-10-11 18:22:59 PDT
Comment on attachment 168327 [details]
patch

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

> Source/WebCore/ChangeLog:12
> +        LocalCurrentGraphicsContext is meant to cause temporary changes to
> +        NSGraphicsContext's currentContext. However, if it is entered when
> +        currentContext is null, it will not restore to null, as a null
> +        m_savedNSGraphicsContext was being used to indicate that the current and
> +        passed-in graphics contexts were equal (and thus no save/restore was required).

You should also mentiong flipping the order of the restores.
Comment 3 Tim Horton 2012-10-11 18:29:48 PDT
http://trac.webkit.org/changeset/131120