fix: disposing workspace comments. (#7264)

* fix: disposing workspace comments.

* whitespace formatting
This commit is contained in:
John Nesky
2023-07-10 09:18:42 -07:00
committed by GitHub
parent bb7697faa2
commit 75ea8d9941
2 changed files with 13 additions and 8 deletions

View File

@@ -144,8 +144,6 @@ export class WorkspaceCommentSvg
}
dom.removeNode(this.svgGroup);
// Dispose of any rendered components
this.disposeInternal();
eventUtils.disable();
super.dispose();
@@ -989,11 +987,6 @@ export class WorkspaceCommentSvg
this.resizeComment();
}
/** Dispose of any rendered comment components. */
private disposeInternal() {
this.disposed_ = true;
}
/**
* Set the focus on the text area.
*

View File

@@ -6,7 +6,6 @@
goog.declareModuleId('Blockly.test.workspaceComment');
import {WorkspaceComment} from '../../build/src/core/workspace_comment.js';
import {
sharedTestSetup,
sharedTestTeardown,
@@ -166,6 +165,19 @@ suite('Workspace comment', function () {
// Nothing should go wrong the second time dispose is called.
comment.dispose();
});
test('WorkspaceCommentSvg disposed', function () {
const comment = new Blockly.WorkspaceCommentSvg(
this.workspace,
'comment text',
0,
0,
'comment id'
);
comment.dispose();
// Nothing should go wrong the second time dispose is called.
comment.dispose();
});
});
suite('Width and height', function () {