Title: [243291] trunk/Source/WebKit
Revision
243291
Author
bfulg...@apple.com
Date
2019-03-21 08:51:07 -0700 (Thu, 21 Mar 2019)

Log 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):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (243290 => 243291)


--- trunk/Source/WebKit/ChangeLog	2019-03-21 15:43:35 UTC (rev 243290)
+++ trunk/Source/WebKit/ChangeLog	2019-03-21 15:51:07 UTC (rev 243291)
@@ -1,3 +1,20 @@
+2019-03-21  Brent Fulgham  <bfulg...@apple.com>
+
+        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):
+
 2019-03-21  Carlos Garcia Campos  <cgar...@igalia.com>
 
         [GTK][WPE] Add API to provide geolocation information

Modified: trunk/Source/WebKit/UIProcess/WebColorPicker.cpp (243290 => 243291)


--- trunk/Source/WebKit/UIProcess/WebColorPicker.cpp	2019-03-21 15:43:35 UTC (rev 243290)
+++ trunk/Source/WebKit/UIProcess/WebColorPicker.cpp	2019-03-21 15:51:07 UTC (rev 243291)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2012 Samsung Electronics. All rights reserved.
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -44,8 +45,8 @@
     if (!m_client)
         return;
 
-    m_client->didEndColorPicker();
-    m_client = nullptr;
+    if (auto client = std::exchange(m_client, nullptr))
+        client->didEndColorPicker();
 }
 
 void WebColorPicker::setSelectedColor(const WebCore::Color& color)

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (243290 => 243291)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2019-03-21 15:43:35 UTC (rev 243290)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2019-03-21 15:51:07 UTC (rev 243291)
@@ -5475,10 +5475,10 @@
 
 void WebPageProxy::didEndColorPicker()
 {
+    m_colorPicker = nullptr;
     if (!hasRunningProcess())
         return;
 
-    m_colorPicker = nullptr;
     m_process->send(Messages::WebPage::DidEndColorPicker(), m_pageID);
 }
 #endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to