Changeset 25124 in webkit


Ignore:
Timestamp:
Aug 17, 2007 1:42:38 AM (17 years ago)
Author:
oliver
Message:

LayoutTests:

Reviewed by Maciej.

Simple test to ensure we don't crash when creating a pattern

  • fast/canvas/create-pattern-does-not-crash-expected.txt: Added.
  • fast/canvas/create-pattern-does-not-crash.html: Added.

WebCore:

Reviewed by Maciej.

http://bugs.webkit.org/show_bug.cgi?id=14189
<rdar://problem/5319511> REPRODUCIBLE CRASH: Canvas createPattern(canvas, ...) crashes on Windows (14189)

Ensure that we actually retain the CG pattern correctly.

Credit to Philip Taylor <excors@gmail.com> for finding the cause of this.

  • html/CanvasPattern.cpp: (WebCore::CanvasPattern::~CanvasPattern): (WebCore::CanvasPattern::createPattern):
  • html/CanvasPattern.h: (WebCore::CanvasPattern::platformImage):
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r25115 r25124  
     12007-08-17  Oliver Hunt  <oliver@apple.com>
     2
     3        Reviewed by Maciej.
     4
     5        Simple test to ensure we don't crash when creating a pattern
     6
     7        * fast/canvas/create-pattern-does-not-crash-expected.txt: Added.
     8        * fast/canvas/create-pattern-does-not-crash.html: Added.
     9
    1102007-08-16  Justin Garcia  <justin.garcia@apple.com>
    211
  • trunk/WebCore/ChangeLog

    r25116 r25124  
     12007-08-17  Oliver Hunt  <oliver@apple.com>
     2
     3        Reviewed by Maciej.
     4
     5        http://bugs.webkit.org/show_bug.cgi?id=14189
     6        <rdar://problem/5319511> REPRODUCIBLE CRASH: Canvas createPattern(canvas, ...) crashes on Windows (14189)
     7
     8        Ensure that we actually retain the CG pattern correctly.
     9
     10        Credit to Philip Taylor <excors@gmail.com> for finding the cause of this.
     11
     12        * html/CanvasPattern.cpp:
     13        (WebCore::CanvasPattern::~CanvasPattern):
     14        (WebCore::CanvasPattern::createPattern):
     15        * html/CanvasPattern.h:
     16        (WebCore::CanvasPattern::platformImage):
     17
    1182007-08-16  Geoffrey Garen  <ggaren@apple.com>
    219
  • trunk/WebCore/html/CanvasPattern.cpp

    r24970 r25124  
    9292CanvasPattern::~CanvasPattern()
    9393{
    94 #if PLATFORM(CG)
    95     CGImageRelease(m_platformImage);
    96 #endif
    9794    if (m_cachedImage)
    9895        m_cachedImage->deref(this);
     
    143140    rect.origin.y = 0;
    144141    if (m_platformImage) {
    145         rect.size.width = CGImageGetWidth(m_platformImage);
    146         rect.size.height = CGImageGetHeight(m_platformImage);
     142        rect.size.width = CGImageGetWidth(m_platformImage.get());
     143        rect.size.height = CGImageGetHeight(m_platformImage.get());
    147144    } else {
    148145        if (!m_cachedImage)
  • trunk/WebCore/html/CanvasPattern.h

    r18874 r25124  
    3131
    3232#if PLATFORM(CG)
     33#include <wtf/RetainPtr.h>
    3334#include <ApplicationServices/ApplicationServices.h>
    3435#endif
     
    5253
    5354#if PLATFORM(CG)
    54         CGImageRef platformImage() const { return m_platformImage; }
     55        CGImageRef platformImage() const { return m_platformImage.get(); }
    5556#endif
    5657        CachedImage* cachedImage() const { return m_cachedImage; }
     
    6263    private:
    6364#if PLATFORM(CG)
    64         const CGImageRef m_platformImage;
     65        const RetainPtr<CGImageRef> m_platformImage;
    6566#endif
    6667        CachedImage* const m_cachedImage;
Note: See TracChangeset for help on using the changeset viewer.