Skip to content

Commit

Permalink
#1386 - Adds more safeguards to #kill method
Browse files Browse the repository at this point in the history
  • Loading branch information
jacomyal committed Oct 3, 2023
1 parent 9fcc2f1 commit 02fd1c0
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/sigma.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1820,10 +1820,25 @@ export default class Sigma<GraphType extends Graph = Graph> extends TypedEventEm
this.renderHighlightedNodesFrame = null;
}

// Destroying WebGL contexts
for (const id in this.webGLContexts) {
const context = this.webGLContexts[id];
context.getExtension("WEBGL_lose_context")?.loseContext();
}

// Destroying canvases
const container = this.container;

while (container.firstChild) container.removeChild(container.firstChild);

// Destroying remaining collections
this.canvasContexts = {};
this.webGLContexts = {};
this.elements = {};

this.nodePrograms = {};
this.nodeHoverPrograms = {};
this.edgePrograms = {};
}

/**
Expand Down

0 comments on commit 02fd1c0

Please sign in to comment.