Title: [244011] releases/WebKitGTK/webkit-2.24/Source/WebKit
Revision
244011
Author
[email protected]
Date
2019-04-08 05:39:27 -0700 (Mon, 08 Apr 2019)

Log Message

Merge r243291 - 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: releases/WebKitGTK/webkit-2.24/Source/WebKit/ChangeLog (244010 => 244011)


--- releases/WebKitGTK/webkit-2.24/Source/WebKit/ChangeLog	2019-04-08 12:39:23 UTC (rev 244010)
+++ releases/WebKitGTK/webkit-2.24/Source/WebKit/ChangeLog	2019-04-08 12:39:27 UTC (rev 244011)
@@ -1,3 +1,20 @@
+2019-03-21  Brent Fulgham  <[email protected]>
+
+        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-28  Michael Catanzaro  <[email protected]>
 
         [WPE][GTK] webkit_web_resource_get_data_finish can return NULL without setting error

Modified: releases/WebKitGTK/webkit-2.24/Source/WebKit/UIProcess/WebColorPicker.cpp (244010 => 244011)


--- releases/WebKitGTK/webkit-2.24/Source/WebKit/UIProcess/WebColorPicker.cpp	2019-04-08 12:39:23 UTC (rev 244010)
+++ releases/WebKitGTK/webkit-2.24/Source/WebKit/UIProcess/WebColorPicker.cpp	2019-04-08 12:39:27 UTC (rev 244011)
@@ -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: releases/WebKitGTK/webkit-2.24/Source/WebKit/UIProcess/WebPageProxy.cpp (244010 => 244011)


--- releases/WebKitGTK/webkit-2.24/Source/WebKit/UIProcess/WebPageProxy.cpp	2019-04-08 12:39:23 UTC (rev 244010)
+++ releases/WebKitGTK/webkit-2.24/Source/WebKit/UIProcess/WebPageProxy.cpp	2019-04-08 12:39:27 UTC (rev 244011)
@@ -5336,10 +5336,10 @@
 
 void WebPageProxy::didEndColorPicker()
 {
+    m_colorPicker = nullptr;
     if (!isValid())
         return;
 
-    m_colorPicker = nullptr;
     m_process->send(Messages::WebPage::DidEndColorPicker(), m_pageID);
 }
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to