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

Changeset 271467 in webkit


Ignore:
Timestamp:
Jan 13, 2021, 3:19:23 PM (6 years ago)
Author:
jiewen_tan@apple.com
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):

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r271459 r271467  
     12021-01-13  Jiewen Tan  <jiewen_tan@apple.com>
     2
     3        Crash at SOAuthorizationSession::dismissViewController
     4        https://bugs.webkit.org/show_bug.cgi?id=220482
     5        <rdar://problem/72375494>
     6
     7        Reviewed by Darin Adler.
     8
     9        A crash report suggests that SOAuthorizationSession::dismissViewController could crash at evaluating m_page.
     10        This could only happen if the SOAuthorizationSession object is freed. The stack trace starts with callbacks
     11        from NSNotificationCenter, which capture a RefPtr of the SOAuthorizationSession object and should guarantee
     12        the lifetime of the object. So it contradicts the crash report.
     13
     14        One of the possible explanations is that the RefPtr is somehow over-released within NSNotificationCenter since
     15        it's not thread-safe. To fix that, the RefPtr can be made thread-safe.
     16
     17        No tests.
     18
     19        * UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm:
     20        (WebKit::SOAuthorizationSession::dismissViewController):
     21
    1222021-01-13  Wenson Hsieh  <wenson_hsieh@apple.com>
    223
  • trunk/Source/WebKit/UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.h

    r255862 r271467  
    3030#include <pal/spi/cocoa/AppSSOSPI.h>
    3131#include <wtf/Forward.h>
    32 #include <wtf/RefCounted.h>
    3332#include <wtf/RetainPtr.h>
     33#include <wtf/ThreadSafeRefCounted.h>
    3434#include <wtf/WeakObjCPtr.h>
    3535#include <wtf/WeakPtr.h>
     
    5252
    5353// A session will only be executed once.
    54 class SOAuthorizationSession : public RefCounted<SOAuthorizationSession>, public CanMakeWeakPtr<SOAuthorizationSession> {
     54class SOAuthorizationSession : public ThreadSafeRefCounted<SOAuthorizationSession, WTF::DestructionThread::MainRunLoop>, public CanMakeWeakPtr<SOAuthorizationSession> {
    5555public:
    5656    enum class InitiatingAction : uint8_t {
Note: See TracChangeset for help on using the changeset viewer.