The constructor for WebProcessPool calls a method 'notifyThisWebProcessPoolWasCreated', which calls a set of functions registered by observers interested in knowing that the pool was constructed. However, since this call is made during the construction of the object, code that attempts to do things like Ref<> the WebProcessPool do so with a partially-constructed object. Instead, we should enqueue the notification call so that it fires on the next spin of the runloop, after the current object is finished being constructed.
<rdar://problem/60564526>
Created attachment 393914 [details] Patch
Comment on attachment 393914 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=393914&action=review I think this is likely fine. I have added Brady in cc though because I think he added this code. > Source/WebKit/UIProcess/WebProcessPool.cpp:309 > + ASSERT(isMainThread()); We should not be using isMainThread() in the UIProcess because an app on iOS may be using for WK1 and WK2. You want RunLoop::isMain() instead. > Source/WebKit/UIProcess/WebProcessPool.cpp:310 > + callOnMainThread([weakPtr = makeWeakPtr(this)] { makeWeakPtr(*this) will save a branch. Also this needs to be RunLoop::main() dispatch() for same reasons as above.
Created attachment 393918 [details] Patch for landing
Created attachment 393920 [details] Patch for landing
Committed r258671: <https://trac.webkit.org/changeset/258671> All reviewed patches have been landed. Closing bug and clearing flags on attachment 393920 [details].