Skip to content
This repository was archived by the owner on Jun 4, 2023. It is now read-only.

Commit c89363e

Browse files
authored
fix: process hang due to theme source endless loop (#469)
1 parent f8d142f commit c89363e

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

src/main/models/settings.ts

+7-4
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,18 @@ export class Settings extends EventEmitter {
7373
};
7474

7575
public update = () => {
76+
let themeSource = 'system';
77+
7678
if (this.object.themeAuto) {
7779
this.object.theme = nativeTheme.shouldUseDarkColors
7880
? 'wexond-dark'
7981
: 'wexond-light';
80-
81-
nativeTheme.themeSource = 'system';
8282
} else {
83-
nativeTheme.themeSource =
84-
this.object.theme === 'wexond-dark' ? 'dark' : 'light';
83+
themeSource = this.object.theme === 'wexond-dark' ? 'dark' : 'light';
84+
}
85+
86+
if (themeSource !== nativeTheme.themeSource) {
87+
nativeTheme.themeSource = themeSource as any;
8588
}
8689

8790
Application.instance.dialogs.sendToAll('update-settings', this.object);

src/main/services/dialogs-service.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,9 @@ export class DialogsService {
305305
};
306306

307307
public sendToAll = (channel: string, ...args: any[]) => {
308-
this.getBrowserViews().forEach((x) => x.webContents.send(channel, ...args));
308+
this.getBrowserViews().forEach(
309+
(x) => !x.isDestroyed() && x.webContents.send(channel, ...args),
310+
);
309311
};
310312

311313
public get(name: string) {

src/main/view.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ export class View {
200200
this.emitEvent('favicon-updated', fav);
201201
} catch (e) {
202202
this.favicon = '';
203-
console.error(e);
203+
// console.error(e);
204204
}
205205
},
206206
);

0 commit comments

Comments
 (0)