⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 274675 in webkit


Ignore:
Timestamp:
Mar 18, 2021, 3:09:49 PM (5 years ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by Rob Buis <rbuis@igalia.com> 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):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r274673 r274675  
     12021-03-18  Rob Buis  <rbuis@igalia.com>
     2
     3        Protect frame before calling setPrinting
     4        https://bugs.webkit.org/show_bug.cgi?id=222664
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Protect frame before calling setPrinting
     9        since it could potentially delete the frame
     10        through event handling.
     11
     12        * page/PrintContext.cpp:
     13        (WebCore::PrintContext::begin):
     14
    1152021-03-18  Antti Koivisto  <antti@apple.com>
    216
  • trunk/Source/WebCore/page/PrintContext.cpp

    r264565 r274675  
    192192        return;
    193193
    194     auto& frame = *this->frame();
     194    auto frame = makeRef(*this->frame());
    195195    // This function can be called multiple times to adjust printing parameters without going back to screen mode.
    196196    m_isPrinting = true;
    197197
    198198    FloatSize originalPageSize = FloatSize(width, height);
    199     FloatSize minLayoutSize = frame.resizePageRectsKeepingRatio(originalPageSize, FloatSize(width * minimumShrinkFactor(), height * minimumShrinkFactor()));
     199    FloatSize minLayoutSize = frame->resizePageRectsKeepingRatio(originalPageSize, FloatSize(width * minimumShrinkFactor(), height * minimumShrinkFactor()));
    200200
    201201    // This changes layout, so callers need to make sure that they don't paint to screen while in printing mode.
    202     frame.setPrinting(true, minLayoutSize, originalPageSize, maximumShrinkFactor() / minimumShrinkFactor(), AdjustViewSize);
     202    frame->setPrinting(true, minLayoutSize, originalPageSize, maximumShrinkFactor() / minimumShrinkFactor(), AdjustViewSize);
    203203}
    204204
Note: See TracChangeset for help on using the changeset viewer.