Fix audio notification crash and missing file types in settings#1
Fix audio notification crash and missing file types in settings#1
Conversation
This change addresses a critical bug where the application would crash when attempting to play a notification sound due to a race condition in `AudioService.cs` when renting a shared `AudioPlaybackDevice`. It adds a `try-catch` block for `ObjectDisposedException` to safely handle disposed devices and re-initialize them. Additionally, it fixes an issue where users could not select custom notification sound files because the `AudioFileTypes` list in `NotificationSettingsPage.axaml.cs` was empty. Common audio file extensions and an "All files" option have been added. Fixes ClassIsland#1485 Co-authored-by: kaokao221 <88539021+kaokao221@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
This commit addresses a critical application crash (Access Violation) caused by rapid initialization and disposal of the audio device (miniaudio backend) when playing notification sounds. Changes: - Implemented a debounce mechanism in `AudioService.cs` using `System.Threading.Timer` to keep the shared `AudioPlaybackDevice` alive for 5 seconds after the last use. This prevents rapid re-initialization cycles that were triggering the native crash. - Added a `try-catch` block for `ObjectDisposedException` when renting the audio device as an additional safety measure. - Populated `AudioFileTypes` in `NotificationSettingsPage.axaml.cs` with common audio file extensions (*.wav, *.mp3, *.ogg, *.flac, *.m4a, *.wma, *.aac) and `FilePickerFileTypes.All` to allow users to select custom sound files, fixing an issue where the file picker filter was empty. Fixes ClassIsland#1485 Co-authored-by: kaokao221 <88539021+kaokao221@users.noreply.github.com>
_sharedAudioPlaybackDevice.Rent()inAudioService.cswith atry-catchblock to handleObjectDisposedException, preventing crashes during rapid re-initialization or concurrent access.AudioFileTypesinNotificationSettingsPage.axaml.cswith common audio extensions (*.wav, *.mp3, *.ogg, *.flac, *.m4a, *.wma, *.aac) andFilePickerFileTypes.Allto allow users to select custom sound files.PR created automatically by Jules for task 15160178287493207890 started by @kaokao221