Crash under WebKit: WTF::Function<void ()>::CallableWrapper<WebKit::ResourceLoadStati...
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Aug 2018 23:41:36 +0000 (23:41 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Aug 2018 23:41:36 +0000 (23:41 +0000)
commit041feabfa979ccb13cf659cee1673fcf2a42a823
tree6f7c4b72fd3e1ea11ca182ed73effb9e8fa61f44
parent0a5c1777c83ed8383d8944fad16366312e2e8015
Crash under WebKit: WTF::Function<void ()>::CallableWrapper<WebKit::ResourceLoadStatisticsMemoryStore::removeDataRecords(WTF::CompletionHandler<void ()>&&)::$_1>::call()
https://bugs.webkit.org/show_bug.cgi?id=189098
<rdar://problem/43179891>

Reviewed by Youenn Fablet.

The crash was caused by implicitly using |this| on the main thread by accessing member variables, even though
|this| gets destroyed on the statistics queue. To address the issue, capture what we need on the statistics
queue, *before* dispatching to the main thread.

Also stop capturing |this| in the lambdas to make this less error prone.

* UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
(WebKit::ResourceLoadStatisticsMemoryStore::removeDataRecords):
(WebKit::ResourceLoadStatisticsMemoryStore::grandfatherExistingWebsiteData):
(WebKit::ResourceLoadStatisticsMemoryStore::updateCookieBlocking):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235487 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.cpp