Fix undefined mainWindow on close confirmation timeout
This commit is contained in:
parent
61548061b8
commit
5987350dbe
1 changed files with 14 additions and 7 deletions
21
app/main.ts
21
app/main.ts
|
@ -890,15 +890,18 @@ async function createWindow() {
|
||||||
* if the user is in fullscreen mode and closes the window, not the
|
* if the user is in fullscreen mode and closes the window, not the
|
||||||
* application, we need them leave fullscreen first before closing it to
|
* application, we need them leave fullscreen first before closing it to
|
||||||
* prevent a black screen.
|
* prevent a black screen.
|
||||||
|
* Also check for mainWindow because it might become undefined while
|
||||||
|
* waiting for close confirmation.
|
||||||
*
|
*
|
||||||
* issue: https://github.com/signalapp/Signal-Desktop/issues/4348
|
* issue: https://github.com/signalapp/Signal-Desktop/issues/4348
|
||||||
*/
|
*/
|
||||||
|
if (mainWindow) {
|
||||||
if (mainWindow.isFullScreen()) {
|
if (mainWindow.isFullScreen()) {
|
||||||
mainWindow.once('leave-full-screen', () => mainWindow?.hide());
|
mainWindow.once('leave-full-screen', () => mainWindow?.hide());
|
||||||
mainWindow.setFullScreen(false);
|
mainWindow.setFullScreen(false);
|
||||||
} else {
|
} else {
|
||||||
mainWindow.hide();
|
mainWindow.hide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// On Mac, or on other platforms when the tray icon is in use, the window
|
// On Mac, or on other platforms when the tray icon is in use, the window
|
||||||
|
@ -906,7 +909,11 @@ async function createWindow() {
|
||||||
const usingTrayIcon = shouldMinimizeToSystemTray(
|
const usingTrayIcon = shouldMinimizeToSystemTray(
|
||||||
await systemTraySettingCache.get()
|
await systemTraySettingCache.get()
|
||||||
);
|
);
|
||||||
if (!windowState.shouldQuit() && (usingTrayIcon || OS.isMacOS())) {
|
if (
|
||||||
|
mainWindow &&
|
||||||
|
!windowState.shouldQuit() &&
|
||||||
|
(usingTrayIcon || OS.isMacOS())
|
||||||
|
) {
|
||||||
if (usingTrayIcon) {
|
if (usingTrayIcon) {
|
||||||
const shownTrayNotice = ephemeralConfig.get('shown-tray-notice');
|
const shownTrayNotice = ephemeralConfig.get('shown-tray-notice');
|
||||||
if (shownTrayNotice) {
|
if (shownTrayNotice) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue