Title: [280898] releases/WebKitGTK/webkit-2.32/Source/WebCore
Revision
280898
Author
[email protected]
Date
2021-08-11 03:21:04 -0700 (Wed, 11 Aug 2021)

Log Message

Merge r274675 - Protect frame before calling setPrinting
https://bugs.webkit.org/show_bug.cgi?id=222664

Patch by Rob Buis <[email protected]> on 2021-03-18
Reviewed by Ryosuke Niwa.

Protect frame before calling setPrinting
since it could potentially delete the frame
through event handling.

* page/PrintContext.cpp:
(WebCore::PrintContext::begin):

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.32/Source/WebCore/ChangeLog (280897 => 280898)


--- releases/WebKitGTK/webkit-2.32/Source/WebCore/ChangeLog	2021-08-11 10:20:25 UTC (rev 280897)
+++ releases/WebKitGTK/webkit-2.32/Source/WebCore/ChangeLog	2021-08-11 10:21:04 UTC (rev 280898)
@@ -1,3 +1,17 @@
+2021-03-18  Rob Buis  <[email protected]>
+
+        Protect frame before calling setPrinting
+        https://bugs.webkit.org/show_bug.cgi?id=222664
+
+        Reviewed by Ryosuke Niwa.
+
+        Protect frame before calling setPrinting
+        since it could potentially delete the frame
+        through event handling.
+
+        * page/PrintContext.cpp:
+        (WebCore::PrintContext::begin):
+
 2021-02-26  Sergio Villar Senin  <[email protected]>
 
         Invalidate RenderTreePosition's next sibling with display:contents

Modified: releases/WebKitGTK/webkit-2.32/Source/WebCore/page/PrintContext.cpp (280897 => 280898)


--- releases/WebKitGTK/webkit-2.32/Source/WebCore/page/PrintContext.cpp	2021-08-11 10:20:25 UTC (rev 280897)
+++ releases/WebKitGTK/webkit-2.32/Source/WebCore/page/PrintContext.cpp	2021-08-11 10:21:04 UTC (rev 280898)
@@ -191,15 +191,15 @@
     if (!frame())
         return;
 
-    auto& frame = *this->frame();
+    auto frame = makeRef(*this->frame());
     // This function can be called multiple times to adjust printing parameters without going back to screen mode.
     m_isPrinting = true;
 
     FloatSize originalPageSize = FloatSize(width, height);
-    FloatSize minLayoutSize = frame.resizePageRectsKeepingRatio(originalPageSize, FloatSize(width * minimumShrinkFactor(), height * minimumShrinkFactor()));
+    FloatSize minLayoutSize = frame->resizePageRectsKeepingRatio(originalPageSize, FloatSize(width * minimumShrinkFactor(), height * minimumShrinkFactor()));
 
     // This changes layout, so callers need to make sure that they don't paint to screen while in printing mode.
-    frame.setPrinting(true, minLayoutSize, originalPageSize, maximumShrinkFactor() / minimumShrinkFactor(), AdjustViewSize);
+    frame->setPrinting(true, minLayoutSize, originalPageSize, maximumShrinkFactor() / minimumShrinkFactor(), AdjustViewSize);
 }
 
 float PrintContext::computeAutomaticScaleFactor(const FloatSize& availablePaperSize)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to