Title: [243578] branches/safari-607-branch/Source/WebKit
Revision
243578
Author
alanc...@apple.com
Date
2019-03-27 16:43:54 -0700 (Wed, 27 Mar 2019)

Log Message

Cherry-pick r243291. rdar://problem/49307996

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

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243291 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-607-branch/Source/WebKit/ChangeLog (243577 => 243578)


--- branches/safari-607-branch/Source/WebKit/ChangeLog	2019-03-27 23:43:52 UTC (rev 243577)
+++ branches/safari-607-branch/Source/WebKit/ChangeLog	2019-03-27 23:43:54 UTC (rev 243578)
@@ -1,5 +1,43 @@
 2019-03-27  Alan Coon  <alanc...@apple.com>
 
+        Cherry-pick r243291. rdar://problem/49307996
+
+    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):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243291 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    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-27  Alan Coon  <alanc...@apple.com>
+
         Apply patch. rdar://problem/49307967
 
     fix-radar-48878188

Modified: branches/safari-607-branch/Source/WebKit/UIProcess/WebColorPicker.cpp (243577 => 243578)


--- branches/safari-607-branch/Source/WebKit/UIProcess/WebColorPicker.cpp	2019-03-27 23:43:52 UTC (rev 243577)
+++ branches/safari-607-branch/Source/WebKit/UIProcess/WebColorPicker.cpp	2019-03-27 23:43:54 UTC (rev 243578)
@@ -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: branches/safari-607-branch/Source/WebKit/UIProcess/WebPageProxy.cpp (243577 => 243578)


--- branches/safari-607-branch/Source/WebKit/UIProcess/WebPageProxy.cpp	2019-03-27 23:43:52 UTC (rev 243577)
+++ branches/safari-607-branch/Source/WebKit/UIProcess/WebPageProxy.cpp	2019-03-27 23:43:54 UTC (rev 243578)
@@ -5339,10 +5339,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
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to