Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4932734fe3705e5099ffd9522c9bacf7f353e1c3
      
https://github.com/WebKit/WebKit/commit/4932734fe3705e5099ffd9522c9bacf7f353e1c3
  Author: Chris Dumez <[email protected]>
  Date:   2025-01-29 (Wed, 29 Jan 2025)

  Changed paths:
    M Source/WebCore/platform/audio/AudioSession.h
    M Source/WebCore/platform/audio/mac/AudioSessionMac.h
    M Source/WebCore/platform/audio/mac/AudioSessionMac.mm
    M Source/WebKit/WebProcess/GPU/media/RemoteAudioSession.h

  Log Message:
  -----------
  Crash under 
WTF::Detail::CallableWrapper<WebCore::AudioSessionMac::handleDefaultDeviceChange>
https://bugs.webkit.org/show_bug.cgi?id=286663
rdar://143505451

Reviewed by Jer Noble.

AudioSessionMac was calling `callOnMainThread()` in several places and 
capturing a raw pointer
to the session. That pointer may no longer be valid once the lambda runs 
asynchronously.

To address the issue, use AudioObjectAddPropertyListenerBlock() instead of 
AudioObjectAddPropertyListener()
so we can pass a block capturing a ThreadSafeWeakPtr to the session and so that 
we can request it be
dispatched to the main queue.

* Source/WebCore/platform/audio/AudioSession.h:
* Source/WebCore/platform/audio/mac/AudioSessionMac.h:
* Source/WebCore/platform/audio/mac/AudioSessionMac.mm:
(WebCore::AudioSessionMac::removePropertyListenersForDefaultDevice const):
(WebCore::AudioSessionMac::handleDefaultDeviceChange):
(WebCore::AudioSessionMac::addDefaultDeviceObserverIfNeeded const):
(WebCore::AudioSessionMac::addSampleRateObserverIfNeeded const):
(WebCore::AudioSessionMac::addBufferSizeObserverIfNeeded const):
(WebCore::AudioSessionMac::addMuteChangeObserverIfNeeded const):
(WebCore::AudioSessionMac::removeMuteChangeObserverIfNeeded const):
(WebCore::AudioSessionMac::handleSampleRateChange): Deleted.
(WebCore::AudioSessionMac::handleBufferSizeChange): Deleted.
(WebCore::handleMutePropertyChange): Deleted.
* Source/WebKit/WebProcess/GPU/media/RemoteAudioSession.h:

Canonical link: https://commits.webkit.org/289502@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to