This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Cocoa] Null-pointer deref in MediaKeySystemAccess::createMediaKeys()
https://bugs.webkit.org/show_bug.cgi?id=227911 <rdar://80325855> Reviewed by Chris Dumez. In r278481, we moved from a (timer-based) GenericTaskQueue to the document's event loop, but in so doing, allowed the passed-in lambda to be called after the underlying object had been destroyed. Make MediaKeySystemAccess a CanMakeWeakPtr and pass in a WeakPtr to the lambda. To ensure that the lambda itself keeps MediaKeySystemAccess during the execution of the lambda, also add a Ref to the object after null-checking weakThis. * Modules/encryptedmedia/MediaKeySystemAccess.cpp: (WebCore::MediaKeySystemAccess::createMediaKeys): * Modules/encryptedmedia/MediaKeySystemAccess.h: Canonical link: https://commits.webkit.org/239668@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@279919 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing 3 changed files with 25 additions and 2 deletions.