Skip to content

Commit

Permalink
fix(sharedRw): Fix example delete twice render window node
Browse files Browse the repository at this point in the history
  • Loading branch information
bruyeret authored and finetjul committed Jun 14, 2024
1 parent f56a523 commit 3a44020
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Examples/Rendering/ManyRenderWindows/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,15 @@ function addRenderWindow(actor) {
const button = createRemoveButton();
button.addEventListener('click', () => {
rootContainer.removeChild(container);
mainRenderWindow.removeRenderWindow(renderWindow);
mainRenderWindowView.removeNode(renderWindowView);
interactor.delete();
renderWindowView.delete();

// The core renderWindow is managed by the user, so delete it
mainRenderWindow.removeRenderWindow(renderWindow);
renderWindow.delete();

// The node renderWindowView is managed by vtk.js backend, and removed automatically
mainRenderWindowView.removeNode(renderWindowView);

if (mainRenderWindow.getChildRenderWindowsByReference().length === 0) {
// When there is no child render window anymore, delete the main render window
// We also release the graphics resources, which is not very import as when the context is destroyed, the resources should be freed
Expand Down

0 comments on commit 3a44020

Please sign in to comment.