Skip to content

Commit

Permalink
Be more careful about sessioncontext kernelChanged and sessionChanged…
Browse files Browse the repository at this point in the history
… signal emisssions

Fixes jupyterlab#7690
  • Loading branch information
jasongrout committed Dec 24, 2019
1 parent 023828a commit 3048d17
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
5 changes: 3 additions & 2 deletions packages/apputils/src/sessioncontext.tsx
Expand Up @@ -766,8 +766,10 @@ export class SessionContext implements ISessionContext {
if (this._session) {
this._session.dispose();
}
const oldValue = this._session;
this._session = null;
this._terminated.emit(undefined);
const newValue = this._session;
this._sessionChanged.emit({ name: 'session', oldValue, newValue });
}

/**
Expand Down Expand Up @@ -873,7 +875,6 @@ export class SessionContext implements ISessionContext {
private _initializing = false;
private _initPromise = new PromiseDelegate<boolean>();
private _isReady = false;
private _terminated = new Signal<this, void>(this);
private _kernelChanged = new Signal<
this,
Session.ISessionConnection.IKernelChangedArgs
Expand Down
11 changes: 9 additions & 2 deletions packages/services/src/session/default.ts
Expand Up @@ -206,8 +206,15 @@ export class SessionConnection implements Session.ISessionConnection {
}
this._isDisposed = true;
this._disposed.emit();
this._kernel?.dispose();
this._kernel = null;

if (this._kernel) {
this._kernel.dispose();
let oldValue = this._kernel;
this._kernel = null;
let newValue = this._kernel;
this._kernelChanged.emit({ name: 'kernel', oldValue, newValue });
}

Signal.clearData(this);
}

Expand Down

0 comments on commit 3048d17

Please sign in to comment.