浏览代码

Fix context disposal handling

Steven Silvester 8 年之前
父节点
当前提交
f24a70948d
共有 2 个文件被更改,包括 4 次插入4 次删除
  1. 2 4
      src/docregistry/context.ts
  2. 2 0
      test/src/docregistry/context.spec.ts

+ 2 - 4
src/docregistry/context.ts

@@ -144,10 +144,8 @@ class Context<T extends DocumentRegistry.IModel> implements DocumentRegistry.ICo
     this._manager = null;
     this._factory = null;
     if (this._session) {
-      this._session.shutdown().then(() => {
-        this._session.dispose();
-        this._session = null;
-      });
+      this._session.dispose();
+      this._session = null;
     }
   }
 

+ 2 - 0
test/src/docregistry/context.spec.ts

@@ -41,6 +41,8 @@ describe('docregistry/context', () => {
     afterEach((done) => {
       if (context.kernel) {
         context.kernel.ready.then(() => {
+          return context.changeKernel(null);
+        }).then(() => {
           context.dispose();
         }).then(done, done);
       } else {