Title: [278323] trunk/Source/WebCore
Revision
278323
Author
[email protected]
Date
2021-06-01 13:08:28 -0700 (Tue, 01 Jun 2021)

Log Message

[WinCairo] GraphicsContextCairo::GraphicsContextCairo(HDC, bool) leaks cairo_t
https://bugs.webkit.org/show_bug.cgi?id=226317

Reviewed by Don Olmstead.

* platform/graphics/win/GraphicsContextCairoWin.cpp:
(WebCore::createCairoContextWithHDC): Changed the return type from cairo_t* to RefPtr<cairo_t>.
(WebCore::GraphicsContextCairo::GraphicsContextCairo):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (278322 => 278323)


--- trunk/Source/WebCore/ChangeLog	2021-06-01 20:04:18 UTC (rev 278322)
+++ trunk/Source/WebCore/ChangeLog	2021-06-01 20:08:28 UTC (rev 278323)
@@ -1,3 +1,14 @@
+2021-06-01  Fujii Hironori  <[email protected]>
+
+        [WinCairo] GraphicsContextCairo::GraphicsContextCairo(HDC, bool) leaks cairo_t
+        https://bugs.webkit.org/show_bug.cgi?id=226317
+
+        Reviewed by Don Olmstead.
+
+        * platform/graphics/win/GraphicsContextCairoWin.cpp:
+        (WebCore::createCairoContextWithHDC): Changed the return type from cairo_t* to RefPtr<cairo_t>.
+        (WebCore::GraphicsContextCairo::GraphicsContextCairo):
+
 2021-06-01  Philippe Normand  <[email protected]>
 
         [EME][Thunder] Build broken since r278244

Modified: trunk/Source/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp (278322 => 278323)


--- trunk/Source/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp	2021-06-01 20:04:18 UTC (rev 278322)
+++ trunk/Source/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp	2021-06-01 20:08:28 UTC (rev 278323)
@@ -30,6 +30,7 @@
 #include "DIBPixelData.h"
 #include "GraphicsContextCairo.h"
 #include "Path.h"
+#include "RefPtrCairo.h"
 
 #include <cairo-win32.h>
 #include "GraphicsContextPlatformPrivateCairo.h"
@@ -38,7 +39,7 @@
 namespace WebCore {
 
 #if PLATFORM(WIN)
-static cairo_t* createCairoContextWithHDC(HDC hdc, bool hasAlpha)
+static RefPtr<cairo_t> createCairoContextWithHDC(HDC hdc, bool hasAlpha)
 {
     // Put the HDC In advanced mode so it will honor affine transforms.
     SetGraphicsMode(hdc, GM_ADVANCED);
@@ -60,7 +61,7 @@
                                                info.bmWidthBytes);
     }
 
-    cairo_t* context = cairo_create(surface);
+    auto context = adoptRef(cairo_create(surface));
     cairo_surface_destroy(surface);
 
     return context;
@@ -67,7 +68,7 @@
 }
 
 GraphicsContextCairo::GraphicsContextCairo(HDC dc, bool hasAlpha)
-    : GraphicsContextCairo(createCairoContextWithHDC(dc, hasAlpha))
+    : GraphicsContextCairo(createCairoContextWithHDC(dc, hasAlpha).get())
 {
 }
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to