mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-26 19:44:25 +01:00
save participants do not run on shutdown
This commit is contained in:
@@ -20,6 +20,8 @@ export class LifecycleService implements ILifecycleService {
|
||||
private _onWillShutdown = new Emitter<ShutdownEvent>();
|
||||
private _onShutdown = new Emitter<void>();
|
||||
|
||||
private _willShutdown: boolean;
|
||||
|
||||
constructor(
|
||||
@IMessageService private messageService: IMessageService,
|
||||
@IWindowService private windowService: IWindowService
|
||||
@@ -27,6 +29,10 @@ export class LifecycleService implements ILifecycleService {
|
||||
this.registerListeners();
|
||||
}
|
||||
|
||||
public get willShutdown(): boolean {
|
||||
return this._willShutdown;
|
||||
}
|
||||
|
||||
public get onWillShutdown(): Event<ShutdownEvent> {
|
||||
return this._onWillShutdown.event;
|
||||
}
|
||||
@@ -40,8 +46,12 @@ export class LifecycleService implements ILifecycleService {
|
||||
|
||||
// Main side indicates that window is about to unload, check for vetos
|
||||
ipc.on('vscode:beforeUnload', (event, reply: { okChannel: string, cancelChannel: string }) => {
|
||||
this._willShutdown = true;
|
||||
|
||||
// trigger onWillShutdown events and veto collecting
|
||||
this.onBeforeUnload().done(veto => {
|
||||
if (veto) {
|
||||
this._willShutdown = false; // reset this flag since the shutdown has been vetoed!
|
||||
ipc.send(reply.cancelChannel, windowId);
|
||||
} else {
|
||||
this._onShutdown.fire();
|
||||
|
||||
Reference in New Issue
Block a user