REGRESSION(r227594) [WinCairo] NULL pointer crash in GraphicsContext::getWindowsContext
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 Feb 2018 00:16:50 +0000 (00:16 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 Feb 2018 00:16:50 +0000 (00:16 +0000)
commitb0a3719fb46bed37cba60a61737040dc3c114b0c
treeed46d04993b5002f529b834ed5fa221c345de03c
parentdd27da8c1f755ec871ac579c0ba7b565cf90b7d7
REGRESSION(r227594) [WinCairo] NULL pointer crash in GraphicsContext::getWindowsContext
https://bugs.webkit.org/show_bug.cgi?id=182282

Patch by Fujii Hironori <Hironori.Fujii@sony.com> on 2018-02-01
Reviewed by Žan Doberšek.

ImageBufferCairo has been changed to use GraphicsContextImplCairo
in r227594. But, GraphicsContext::getWindowsContext doesn't care
the case of using GraphicsContextImpl and crashes due to null
dereference of GraphicsContext::m_data.

GraphicsContext::getWindowsContext should create a HDC in that case.

Remove the argument mayCreateBitmap because it is always
true at the moment.

No new tests (Covered by the existing tests)

* platform/graphics/GraphicsContext.h:
Removed a argument mayCreateBitmap of getWindowsContext and releaseWindowsContext.
* platform/graphics/win/GraphicsContextCGWin.cpp:
(WebCore::GraphicsContext::releaseWindowsContext): Ditto.
* platform/graphics/win/GraphicsContextCairoWin.cpp:
(WebCore::GraphicsContext::releaseWindowsContext): Ditto.
* platform/graphics/win/GraphicsContextDirect2D.cpp:
(WebCore::GraphicsContext::releaseWindowsContext): Ditto.
* platform/graphics/win/GraphicsContextWin.cpp:
(WebCore::GraphicsContext::getWindowsContext):
Create a HDC if m_impl is null. Removed a argument mayCreateBitmap.
* platform/graphics/win/LocalWindowsContext.h:
(WebCore::LocalWindowsContext::LocalWindowsContext):
Removed m_mayCreateBitmap.
(WebCore::LocalWindowsContext::~LocalWindowsContext): Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227988 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/GraphicsContext.h
Source/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp
Source/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp
Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp
Source/WebCore/platform/graphics/win/GraphicsContextWin.cpp
Source/WebCore/platform/graphics/win/LocalWindowsContext.h