REGRESSION(r227594) [WinCairo] NULL pointer crash in GraphicsContext::getWindowsContext
[WebKit-https.git] / Source / WebCore / platform / graphics / win / GraphicsContextWin.cpp
index 49a2103..72b1347 100644 (file)
@@ -100,10 +100,13 @@ std::unique_ptr<GraphicsContext::WindowsBitmap> GraphicsContext::createWindowsBi
 }
 #endif
 
-HDC GraphicsContext::getWindowsContext(const IntRect& dstRect, bool supportAlphaBlend, bool mayCreateBitmap)
+HDC GraphicsContext::getWindowsContext(const IntRect& dstRect, bool supportAlphaBlend)
 {
+    HDC hdc = nullptr;
+    if (!m_impl)
+        hdc = m_data->m_hdc;
     // FIXME: Should a bitmap be created also when a shadow is set?
-    if (mayCreateBitmap && (!m_data->m_hdc || isInTransparencyLayer())) {
+    if (!hdc || isInTransparencyLayer()) {
         if (dstRect.isEmpty())
             return 0;
 
@@ -115,7 +118,7 @@ HDC GraphicsContext::getWindowsContext(const IntRect& dstRect, bool supportAlpha
         if (!bitmap)
             return 0;
 
-        auto bitmapDC = adoptGDIObject(::CreateCompatibleDC(m_data->m_hdc));
+        auto bitmapDC = adoptGDIObject(::CreateCompatibleDC(hdc));
         ::SelectObject(bitmapDC.get(), bitmap);
 
         // Fill our buffer with clear if we're going to alpha blend.