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
|
||||
if (await this.isFirstLoad() && this.productService.deployFunc) {
|
||||
this.lifecycleMainService.appQuitFlagDeploy = true;
|
||||
await appInstantiationService.invokeFunction(accessor => this.openDeploylWindow(accessor));
|
||||
}
|
||||
|
||||
|
@ -1376,7 +1377,7 @@ export class CodeApplication extends Disposable {
|
|||
DeployMainService.openDeployWindow(true).then(() => {
|
||||
resolve(void 0);
|
||||
}).catch((error) => {
|
||||
console.log(error);
|
||||
this.logService.info(`appts openDeploylWindow ${error}`);
|
||||
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 { IDeployMainService, DeployWindowConfiguration, DeployData } from 'vs/platform/issue/common/deploy';
|
||||
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 { INativeHostMainService } from 'vs/platform/native/electron-main/nativeHostMainService';
|
||||
import product from 'vs/platform/product/common/product';
|
||||
|
@ -122,6 +123,7 @@ export class DeployMainService implements IDeployMainService {
|
|||
constructor(
|
||||
private userEnv: IProcessEnvironment,
|
||||
@IEnvironmentMainService private readonly environmentMainService: IEnvironmentMainService,
|
||||
@ILogService private readonly logService: ILogService,
|
||||
@ILoggerMainService private readonly loggerMainService: ILoggerMainService,
|
||||
@IProtocolMainService private readonly protocolMainService: IProtocolMainService,
|
||||
@INativeHostMainService private readonly nativeHostMainService: INativeHostMainService,
|
||||
|
@ -200,6 +202,7 @@ export class DeployMainService implements IDeployMainService {
|
|||
};
|
||||
listenerCloseWindow = (event: IpcMainEvent, msg: any) => {
|
||||
if (msg.type === 'skip') {
|
||||
this.logService.info("跳过配置");
|
||||
this.logger.info("跳过配置");
|
||||
}
|
||||
if (msg.type === "close") {
|
||||
|
@ -210,6 +213,7 @@ export class DeployMainService implements IDeployMainService {
|
|||
fs.rmdirSync(this.updateConfigDir, { recursive: true });
|
||||
}
|
||||
}
|
||||
this.logService.info("opendeploywindo listenerCloseWindow");
|
||||
this.closeWindow();
|
||||
|
||||
};
|
||||
|
@ -1174,6 +1178,7 @@ export class DeployMainService implements IDeployMainService {
|
|||
}
|
||||
|
||||
closeWindow() {
|
||||
this.logService.info("deploywindow closeWindow");
|
||||
if (this.DeployWindow) {
|
||||
if (this.installProcessId) {
|
||||
this.installProcessId.kill();
|
||||
|
@ -1237,7 +1242,7 @@ export class DeployMainService implements IDeployMainService {
|
|||
try {
|
||||
DeployDisposables.dispose();
|
||||
} catch {
|
||||
this.logger.error("deployDisposables.dispose() catch");
|
||||
this.logger.info("deployDisposables.dispose");
|
||||
}
|
||||
|
||||
resolve(void 0);
|
||||
|
|
|
@ -84,6 +84,8 @@ export interface IRelaunchOptions {
|
|||
|
||||
export interface ILifecycleMainService {
|
||||
|
||||
appQuitFlagDeploy: boolean;
|
||||
|
||||
readonly _serviceBrand: undefined;
|
||||
|
||||
/**
|
||||
|
@ -244,6 +246,7 @@ export class LifecycleMainService extends Disposable implements ILifecycleMainSe
|
|||
private readonly phaseWhen = new Map<LifecycleMainPhase, Barrier>();
|
||||
|
||||
private relaunchHandler: IRelaunchHandler | undefined = undefined;
|
||||
public appQuitFlagDeploy: boolean = false;
|
||||
|
||||
constructor(
|
||||
@ILogService private readonly logService: ILogService,
|
||||
|
@ -251,7 +254,6 @@ export class LifecycleMainService extends Disposable implements ILifecycleMainSe
|
|||
@IEnvironmentMainService private readonly environmentMainService: IEnvironmentMainService
|
||||
) {
|
||||
super();
|
||||
|
||||
this.resolveRestarted();
|
||||
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
|
||||
// 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();
|
||||
}
|
||||
};
|
||||
|
@ -412,6 +418,7 @@ export class LifecycleMainService extends Disposable implements ILifecycleMainSe
|
|||
}
|
||||
|
||||
registerWindow(window: ICodeWindow): void {
|
||||
this.appQuitFlagDeploy = false;
|
||||
const windowListeners = new DisposableStore();
|
||||
|
||||
// track window count
|
||||
|
|
|
@ -15,7 +15,7 @@ export class TestLifecycleMainService implements ILifecycleMainService {
|
|||
_serviceBrand: undefined;
|
||||
|
||||
onBeforeShutdown = Event.None;
|
||||
|
||||
appQuitFlagDeploy: boolean = false;
|
||||
private readonly _onWillShutdown = new Emitter<ShutdownEvent>();
|
||||
readonly onWillShutdown = this._onWillShutdown.event;
|
||||
|
||||
|
|
Loading…
Reference in New Issue