Title: [260544] trunk/Source/WebKit
- Revision
- 260544
- Author
- cdu...@apple.com
- Date
- 2020-04-22 17:04:26 -0700 (Wed, 22 Apr 2020)
Log Message
[iOS] Crash on RunningBoard process assertion invalidation
https://bugs.webkit.org/show_bug.cgi?id=210873
<rdar://problem/62194917>
Reviewed by Darin Adler.
* UIProcess/ios/ProcessAssertionIOS.mm:
(-[WKRBSAssertionDelegate assertion:didInvalidateWithError:]):
Capture a weak pointer to self and make sure we only access the invalidation handler on
the main thread if |self| is still alive.
(WebKit::ProcessAssertion::~ProcessAssertion):
Null out the WKRBSAssertionDelegate's observer in the ProcessAssertion destructor, to
make sure processAssertionWasInvalidated() cannot get called after the ProcessAssertion
has been destroyed.
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (260543 => 260544)
--- trunk/Source/WebKit/ChangeLog 2020-04-22 23:49:29 UTC (rev 260543)
+++ trunk/Source/WebKit/ChangeLog 2020-04-23 00:04:26 UTC (rev 260544)
@@ -1,3 +1,21 @@
+2020-04-22 Chris Dumez <cdu...@apple.com>
+
+ [iOS] Crash on RunningBoard process assertion invalidation
+ https://bugs.webkit.org/show_bug.cgi?id=210873
+ <rdar://problem/62194917>
+
+ Reviewed by Darin Adler.
+
+ * UIProcess/ios/ProcessAssertionIOS.mm:
+ (-[WKRBSAssertionDelegate assertion:didInvalidateWithError:]):
+ Capture a weak pointer to self and make sure we only access the invalidation handler on
+ the main thread if |self| is still alive.
+
+ (WebKit::ProcessAssertion::~ProcessAssertion):
+ Null out the WKRBSAssertionDelegate's observer in the ProcessAssertion destructor, to
+ make sure processAssertionWasInvalidated() cannot get called after the ProcessAssertion
+ has been destroyed.
+
2020-04-22 David Kilzer <ddkil...@apple.com>
IPC::decodeSharedBuffer() should check the return value of SharedMemory::map()
Modified: trunk/Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm (260543 => 260544)
--- trunk/Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm 2020-04-22 23:49:29 UTC (rev 260543)
+++ trunk/Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm 2020-04-23 00:04:26 UTC (rev 260544)
@@ -286,9 +286,12 @@
- (void)assertion:(RBSAssertion *)assertion didInvalidateWithError:(NSError *)error
{
RELEASE_LOG(ProcessSuspension, "%p - WKRBSAssertionDelegate: assertion was invalidated, error: %{public}@", error, self);
+
+ __weak WKRBSAssertionDelegate *weakSelf = self;
dispatch_async(dispatch_get_main_queue(), ^{
- if (_invalidationCallback)
- _invalidationCallback();
+ WKRBSAssertionDelegate *strongSelf = weakSelf;
+ if (strongSelf && strongSelf.invalidationCallback)
+ strongSelf.invalidationCallback();
});
}
@end
@@ -419,6 +422,9 @@
RELEASE_LOG(ProcessSuspension, "%p - ~ProcessAssertion() Releasing process assertion for process with PID %d", this, m_pid);
if (m_rbsAssertion) {
+ m_delegate.get().invalidationCallback = nil;
+ m_delegate = nil;
+
[m_rbsAssertion removeObserver:m_delegate.get()];
[m_rbsAssertion invalidate];
} else {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes