fixed:修复因监听到window-all-closed事件导致闪退的问题
Change-Id: I3e1b9156ba3e721890810cfa9b2284996735ae61
This commit is contained in:
parent
4e6d8e509d
commit
c7ecb9d7ad
|
@ -637,6 +637,7 @@ export class CodeApplication extends Disposable {
|
||||||
|
|
||||||
//install window wait to do by dll
|
//install window wait to do by dll
|
||||||
if (await this.isFirstLoad() && this.productService.deployFunc) {
|
if (await this.isFirstLoad() && this.productService.deployFunc) {
|
||||||
|
this.lifecycleMainService.appQuitFlagDeploy = true;
|
||||||
await appInstantiationService.invokeFunction(accessor => this.openDeploylWindow(accessor));
|
await appInstantiationService.invokeFunction(accessor => this.openDeploylWindow(accessor));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1376,7 +1377,7 @@ export class CodeApplication extends Disposable {
|
||||||
DeployMainService.openDeployWindow(true).then(() => {
|
DeployMainService.openDeployWindow(true).then(() => {
|
||||||
resolve(void 0);
|
resolve(void 0);
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
console.log(error);
|
this.logService.info(`appts openDeploylWindow ${error}`);
|
||||||
resolve(-1);
|
resolve(-1);
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
|
@ -16,6 +16,7 @@ import { validatedIpcMain } from 'vs/base/parts/ipc/electron-main/ipcMain';
|
||||||
import { IEnvironmentMainService } from 'vs/platform/environment/electron-main/environmentMainService';
|
import { IEnvironmentMainService } from 'vs/platform/environment/electron-main/environmentMainService';
|
||||||
import { IDeployMainService, DeployWindowConfiguration, DeployData } from 'vs/platform/issue/common/deploy';
|
import { IDeployMainService, DeployWindowConfiguration, DeployData } from 'vs/platform/issue/common/deploy';
|
||||||
import { ILogger } from 'vs/platform/log/common/log';
|
import { ILogger } from 'vs/platform/log/common/log';
|
||||||
|
import { ILogService } from 'vs/platform/log/common/log';
|
||||||
import { ILoggerMainService } from 'vs/platform/log/electron-main/loggerService';
|
import { ILoggerMainService } from 'vs/platform/log/electron-main/loggerService';
|
||||||
import { INativeHostMainService } from 'vs/platform/native/electron-main/nativeHostMainService';
|
import { INativeHostMainService } from 'vs/platform/native/electron-main/nativeHostMainService';
|
||||||
import product from 'vs/platform/product/common/product';
|
import product from 'vs/platform/product/common/product';
|
||||||
|
@ -122,6 +123,7 @@ export class DeployMainService implements IDeployMainService {
|
||||||
constructor(
|
constructor(
|
||||||
private userEnv: IProcessEnvironment,
|
private userEnv: IProcessEnvironment,
|
||||||
@IEnvironmentMainService private readonly environmentMainService: IEnvironmentMainService,
|
@IEnvironmentMainService private readonly environmentMainService: IEnvironmentMainService,
|
||||||
|
@ILogService private readonly logService: ILogService,
|
||||||
@ILoggerMainService private readonly loggerMainService: ILoggerMainService,
|
@ILoggerMainService private readonly loggerMainService: ILoggerMainService,
|
||||||
@IProtocolMainService private readonly protocolMainService: IProtocolMainService,
|
@IProtocolMainService private readonly protocolMainService: IProtocolMainService,
|
||||||
@INativeHostMainService private readonly nativeHostMainService: INativeHostMainService,
|
@INativeHostMainService private readonly nativeHostMainService: INativeHostMainService,
|
||||||
|
@ -200,6 +202,7 @@ export class DeployMainService implements IDeployMainService {
|
||||||
};
|
};
|
||||||
listenerCloseWindow = (event: IpcMainEvent, msg: any) => {
|
listenerCloseWindow = (event: IpcMainEvent, msg: any) => {
|
||||||
if (msg.type === 'skip') {
|
if (msg.type === 'skip') {
|
||||||
|
this.logService.info("跳过配置");
|
||||||
this.logger.info("跳过配置");
|
this.logger.info("跳过配置");
|
||||||
}
|
}
|
||||||
if (msg.type === "close") {
|
if (msg.type === "close") {
|
||||||
|
@ -210,6 +213,7 @@ export class DeployMainService implements IDeployMainService {
|
||||||
fs.rmdirSync(this.updateConfigDir, { recursive: true });
|
fs.rmdirSync(this.updateConfigDir, { recursive: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.logService.info("opendeploywindo listenerCloseWindow");
|
||||||
this.closeWindow();
|
this.closeWindow();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -1174,6 +1178,7 @@ export class DeployMainService implements IDeployMainService {
|
||||||
}
|
}
|
||||||
|
|
||||||
closeWindow() {
|
closeWindow() {
|
||||||
|
this.logService.info("deploywindow closeWindow");
|
||||||
if (this.DeployWindow) {
|
if (this.DeployWindow) {
|
||||||
if (this.installProcessId) {
|
if (this.installProcessId) {
|
||||||
this.installProcessId.kill();
|
this.installProcessId.kill();
|
||||||
|
@ -1237,7 +1242,7 @@ export class DeployMainService implements IDeployMainService {
|
||||||
try {
|
try {
|
||||||
DeployDisposables.dispose();
|
DeployDisposables.dispose();
|
||||||
} catch {
|
} catch {
|
||||||
this.logger.error("deployDisposables.dispose() catch");
|
this.logger.info("deployDisposables.dispose");
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve(void 0);
|
resolve(void 0);
|
||||||
|
|
|
@ -84,6 +84,8 @@ export interface IRelaunchOptions {
|
||||||
|
|
||||||
export interface ILifecycleMainService {
|
export interface ILifecycleMainService {
|
||||||
|
|
||||||
|
appQuitFlagDeploy: boolean;
|
||||||
|
|
||||||
readonly _serviceBrand: undefined;
|
readonly _serviceBrand: undefined;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -244,6 +246,7 @@ export class LifecycleMainService extends Disposable implements ILifecycleMainSe
|
||||||
private readonly phaseWhen = new Map<LifecycleMainPhase, Barrier>();
|
private readonly phaseWhen = new Map<LifecycleMainPhase, Barrier>();
|
||||||
|
|
||||||
private relaunchHandler: IRelaunchHandler | undefined = undefined;
|
private relaunchHandler: IRelaunchHandler | undefined = undefined;
|
||||||
|
public appQuitFlagDeploy: boolean = false;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@ILogService private readonly logService: ILogService,
|
@ILogService private readonly logService: ILogService,
|
||||||
|
@ -251,7 +254,6 @@ export class LifecycleMainService extends Disposable implements ILifecycleMainSe
|
||||||
@IEnvironmentMainService private readonly environmentMainService: IEnvironmentMainService
|
@IEnvironmentMainService private readonly environmentMainService: IEnvironmentMainService
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.resolveRestarted();
|
this.resolveRestarted();
|
||||||
this.when(LifecycleMainPhase.Ready).then(() => this.registerListeners());
|
this.when(LifecycleMainPhase.Ready).then(() => this.registerListeners());
|
||||||
}
|
}
|
||||||
|
@ -298,7 +300,11 @@ export class LifecycleMainService extends Disposable implements ILifecycleMainSe
|
||||||
|
|
||||||
// Windows/Linux: we quit when all windows have closed
|
// Windows/Linux: we quit when all windows have closed
|
||||||
// Mac: we only quit when quit was requested
|
// Mac: we only quit when quit was requested
|
||||||
if (this._quitRequested || !isMacintosh) {
|
if (this.appQuitFlagDeploy) {
|
||||||
|
this.appQuitFlagDeploy = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ((!this.appQuitFlagDeploy) && (this._quitRequested || !isMacintosh)) {
|
||||||
app.quit();
|
app.quit();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -412,6 +418,7 @@ export class LifecycleMainService extends Disposable implements ILifecycleMainSe
|
||||||
}
|
}
|
||||||
|
|
||||||
registerWindow(window: ICodeWindow): void {
|
registerWindow(window: ICodeWindow): void {
|
||||||
|
this.appQuitFlagDeploy = false;
|
||||||
const windowListeners = new DisposableStore();
|
const windowListeners = new DisposableStore();
|
||||||
|
|
||||||
// track window count
|
// track window count
|
||||||
|
|
|
@ -15,7 +15,7 @@ export class TestLifecycleMainService implements ILifecycleMainService {
|
||||||
_serviceBrand: undefined;
|
_serviceBrand: undefined;
|
||||||
|
|
||||||
onBeforeShutdown = Event.None;
|
onBeforeShutdown = Event.None;
|
||||||
|
appQuitFlagDeploy: boolean = false;
|
||||||
private readonly _onWillShutdown = new Emitter<ShutdownEvent>();
|
private readonly _onWillShutdown = new Emitter<ShutdownEvent>();
|
||||||
readonly onWillShutdown = this._onWillShutdown.event;
|
readonly onWillShutdown = this._onWillShutdown.event;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue