fix(electron): potential app crash on quit (#12480)

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

- **Bug Fixes**
	- Improved stability during shutdown by preventing potential crashes when removing audio property listeners on macOS.
	- Suppressed unnecessary error logs related to device listener removal during system shutdown.
	- Enhanced handling of internal subscriptions to avoid redundant operations and improve reliability when loading or destroying views.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
pengx17
2025-05-27 03:43:27 +00:00
parent bfe743b68b
commit ed8e50bca6
3 changed files with 47 additions and 19 deletions

View File

@@ -865,6 +865,7 @@ export class WebContentViewsManager {
// shell process do not need to connect to helper process
if (type !== 'shell') {
view.webContents.on('did-finish-load', () => {
unsub();
unsub = helperProcessManager.connectRenderer(view.webContents);
});
} else {
@@ -879,7 +880,6 @@ export class WebContentViewsManager {
}
view.webContents.on('destroyed', () => {
unsub();
this.webViewsMap$.next(
new Map(
[...this.tabViewsMap.entries()].filter(([key]) => key !== viewId)