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

Changeset 243291 in webkit


Ignore:
Timestamp:
Mar 21, 2019, 8:51:07 AM (7 years ago)
Author:
Brent Fulgham
Message:

Fix possible memory leak when dismissing a color picker
https://bugs.webkit.org/show_bug.cgi?id=196026
<rdar://problem/48778568>

Reviewed by Wenson Hsieh.

Fix a problem with WebPageProxy::endColorPicker where an early return could leave a color picker
with a +1 reference count after dismissing it.

  • UIProcess/WebColorPicker.cpp:

(WebKit::WebColorPicker::endPicker):

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::endColorPicker):
(WebKit::WebPageProxy::didEndColorPicker):

Location:
trunk/Source/WebKit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r243285 r243291  
     12019-03-21  Brent Fulgham  <bfulgham@apple.com>
     2
     3        Fix possible memory leak when dismissing a color picker
     4        https://bugs.webkit.org/show_bug.cgi?id=196026
     5        <rdar://problem/48778568>
     6
     7        Reviewed by Wenson Hsieh.
     8
     9        Fix a problem with WebPageProxy::endColorPicker where an early return could leave a color picker
     10        with a +1 reference count after dismissing it.
     11
     12        * UIProcess/WebColorPicker.cpp:
     13        (WebKit::WebColorPicker::endPicker):
     14        * UIProcess/WebPageProxy.cpp:
     15        (WebKit::WebPageProxy::endColorPicker):
     16        (WebKit::WebPageProxy::didEndColorPicker):
     17
    1182019-03-21  Carlos Garcia Campos  <cgarcia@igalia.com>
    219
  • trunk/Source/WebKit/UIProcess/WebColorPicker.cpp

    r234788 r243291  
    11/*
    22 * Copyright (C) 2012 Samsung Electronics. All rights reserved.
     3 * Copyright (C) 2019 Apple Inc. All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    4546        return;
    4647
    47     m_client->didEndColorPicker();
    48     m_client = nullptr;
     48    if (auto client = std::exchange(m_client, nullptr))
     49        client->didEndColorPicker();
    4950}
    5051
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r243231 r243291  
    54765476void WebPageProxy::didEndColorPicker()
    54775477{
    5478     if (!hasRunningProcess())
    5479         return;
    5480 
    54815478    m_colorPicker = nullptr;
     5479    if (!hasRunningProcess())
     5480        return;
     5481
    54825482    m_process->send(Messages::WebPage::DidEndColorPicker(), m_pageID);
    54835483}
Note: See TracChangeset for help on using the changeset viewer.