Переглянути джерело

Merge pull request #8991 from jhamet93/do_not_launch_disposed_dialog

Do not show Dialog If It Has Been Disposed
Steven Silvester 4 роки тому
батько
коміт
4ed798ad9c
1 змінених файлів з 4 додано та 0 видалено
  1. 4 0
      packages/apputils/src/dialog.tsx

+ 4 - 0
packages/apputils/src/dialog.tsx

@@ -153,6 +153,10 @@ export class Dialog<T> extends Widget {
     const promises = Promise.all(Private.launchQueue);
     Private.launchQueue.push(this._promise.promise);
     return promises.then(() => {
+      // Do not show Dialog if it was disposed of before it was at the front of the launch queue
+      if (!this._promise) {
+        return Promise.resolve({ button: Dialog.cancelButton(), value: null });
+      }
       Widget.attach(this, this._host);
       return promise.promise;
     });