提交 2da43c7d 编写于 作者: R rebornix

menu event listener are disposed later than list view itself.

上级 9c7e230f
......@@ -159,6 +159,8 @@ export interface INotebookEditor extends IEditor {
activeKernel: INotebookKernelInfo | undefined;
readonly onDidChangeKernel: Event<void>;
isDisposed: boolean;
getId(): string;
getDomNode(): HTMLElement;
getInnerWebview(): Webview | undefined;
......
......@@ -97,6 +97,10 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
private readonly _onDidFocusWidget = this._register(new Emitter<void>());
public get onDidFocus(): Event<any> { return this._onDidFocusWidget.event; }
get isDisposed() {
return this._isDisposed;
}
constructor(
@IInstantiationService private readonly instantiationService: IInstantiationService,
@IStorageService storageService: IStorageService,
......
......@@ -317,6 +317,10 @@ abstract class AbstractCellRenderer {
updateActions();
disposables.add(menu.onDidChange(() => {
if (this.notebookEditor.isDisposed) {
return;
}
updateActions();
}));
}
......@@ -490,10 +494,12 @@ export class MarkdownCellRenderer extends AbstractCellRenderer implements IListR
}
disposeTemplate(templateData: MarkdownCellRenderTemplate): void {
console.log('dispose templateData');
templateData.disposables.clear();
}
disposeElement(element: ICellViewModel, index: number, templateData: MarkdownCellRenderTemplate, height: number | undefined): void {
console.log('dispose element');
if (height) {
templateData.elementDisposables.clear();
}
......
......@@ -37,6 +37,11 @@ export class TestCell extends NotebookCellTextModel {
}
export class TestNotebookEditor implements INotebookEditor {
private _isDisposed = false;
get isDisposed() {
return this._isDisposed;
}
get viewModel() {
return undefined;
......@@ -216,6 +221,10 @@ export class TestNotebookEditor implements INotebookEditor {
changeDecorations(callback: (changeAccessor: IModelDecorationsChangeAccessor) => any): any {
throw new Error('Method not implemented.');
}
dispose() {
this._isDisposed = true;
}
}
// export function createTestCellViewModel(instantiationService: IInstantiationService, viewType: string, notebookHandle: number, cellhandle: number, source: string[], language: string, cellKind: CellKind, outputs: IOutput[]) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册