Title: [271467] trunk/Source/WebKit
Revision
271467
Author
[email protected]
Date
2021-01-13 15:19:23 -0800 (Wed, 13 Jan 2021)

Log Message

Crash at SOAuthorizationSession::dismissViewController
https://bugs.webkit.org/show_bug.cgi?id=220482
<rdar://problem/72375494>

Reviewed by Darin Adler.

A crash report suggests that SOAuthorizationSession::dismissViewController could crash at evaluating m_page.
This could only happen if the SOAuthorizationSession object is freed. The stack trace starts with callbacks
from NSNotificationCenter, which capture a RefPtr of the SOAuthorizationSession object and should guarantee
the lifetime of the object. So it contradicts the crash report.

One of the possible explanations is that the RefPtr is somehow over-released within NSNotificationCenter since
it's not thread-safe. To fix that, the RefPtr can be made thread-safe.

No tests.

* UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm:
(WebKit::SOAuthorizationSession::dismissViewController):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (271466 => 271467)


--- trunk/Source/WebKit/ChangeLog	2021-01-13 23:18:38 UTC (rev 271466)
+++ trunk/Source/WebKit/ChangeLog	2021-01-13 23:19:23 UTC (rev 271467)
@@ -1,3 +1,24 @@
+2021-01-13  Jiewen Tan  <[email protected]>
+
+        Crash at SOAuthorizationSession::dismissViewController
+        https://bugs.webkit.org/show_bug.cgi?id=220482
+        <rdar://problem/72375494>
+
+        Reviewed by Darin Adler.
+
+        A crash report suggests that SOAuthorizationSession::dismissViewController could crash at evaluating m_page.
+        This could only happen if the SOAuthorizationSession object is freed. The stack trace starts with callbacks
+        from NSNotificationCenter, which capture a RefPtr of the SOAuthorizationSession object and should guarantee
+        the lifetime of the object. So it contradicts the crash report.
+
+        One of the possible explanations is that the RefPtr is somehow over-released within NSNotificationCenter since
+        it's not thread-safe. To fix that, the RefPtr can be made thread-safe.
+
+        No tests.
+
+        * UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm:
+        (WebKit::SOAuthorizationSession::dismissViewController):
+
 2021-01-13  Wenson Hsieh  <[email protected]>
 
         [macOS] "Correct Spelling Automatically" menu items are inconsistent when autocorrect="off"

Modified: trunk/Source/WebKit/UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.h (271466 => 271467)


--- trunk/Source/WebKit/UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.h	2021-01-13 23:18:38 UTC (rev 271466)
+++ trunk/Source/WebKit/UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.h	2021-01-13 23:19:23 UTC (rev 271467)
@@ -29,8 +29,8 @@
 
 #include <pal/spi/cocoa/AppSSOSPI.h>
 #include <wtf/Forward.h>
-#include <wtf/RefCounted.h>
 #include <wtf/RetainPtr.h>
+#include <wtf/ThreadSafeRefCounted.h>
 #include <wtf/WeakObjCPtr.h>
 #include <wtf/WeakPtr.h>
 
@@ -51,7 +51,7 @@
 enum class SOAuthorizationLoadPolicy : uint8_t;
 
 // A session will only be executed once.
-class SOAuthorizationSession : public RefCounted<SOAuthorizationSession>, public CanMakeWeakPtr<SOAuthorizationSession> {
+class SOAuthorizationSession : public ThreadSafeRefCounted<SOAuthorizationSession, WTF::DestructionThread::MainRunLoop>, public CanMakeWeakPtr<SOAuthorizationSession> {
 public:
     enum class InitiatingAction : uint8_t {
         Redirect,
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to