File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
extensions/ql-vscode/src/variant-analysis Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,14 @@ export class VariantAnalysisViewSerializer implements WebviewPanelSerializer {
3737 return ;
3838 }
3939
40+ // Between the time the webview is deserialized and the time the extension
41+ // is fully activated, the user may close the webview. In this case, we
42+ // should not attempt to restore the view.
43+ let disposed = false ;
44+ const unregisterOnDidDispose = webviewPanel . onDidDispose ( ( ) => {
45+ disposed = true ;
46+ } ) ;
47+
4048 const variantAnalysisState : VariantAnalysisState =
4149 state as VariantAnalysisState ;
4250
@@ -46,18 +54,25 @@ export class VariantAnalysisViewSerializer implements WebviewPanelSerializer {
4654 variantAnalysisState . variantAnalysisId ,
4755 ) ;
4856 if ( existingView ) {
57+ unregisterOnDidDispose . dispose ( ) ;
4958 await existingView . openView ( ) ;
5059 webviewPanel . dispose ( ) ;
5160 return ;
5261 }
5362
63+ if ( disposed ) {
64+ return ;
65+ }
66+
5467 const view = new VariantAnalysisView (
5568 this . ctx ,
5669 this . app ,
5770 variantAnalysisState . variantAnalysisId ,
5871 manager ,
5972 ) ;
6073 await view . restoreView ( webviewPanel ) ;
74+
75+ unregisterOnDidDispose . dispose ( ) ;
6176 }
6277
6378 private waitForExtensionFullyLoaded ( ) : Promise <
You can’t perform that action at this time.
0 commit comments