-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dispose
should clear activeInstance
#2701
Comments
You mean something like this? /**
* Clears a canvas element and removes all event listeners
* @return {fabric.Canvas} thisArg
* @chainable
*/
dispose: function () {
this.clear();
this.interactive && this.removeListeners();
if (fabric.Canvas.activeInstance === this) {
fabric.Canvas.activeInstance = null;
}
return this;
}, |
Exactly. |
i do not really know the use of tha activeInstance property. track the canvas variable and clean it? and in case of multiple canvases? |
I agree that we should be clearing it |
this is a fast pr. |
proposed this in a PR in dispose method: + var klass = fabric[fabric.util.string.capitalize(this.type)];
+ if (klass.activeInstance === this) {
+ klass.activeInstance = null;
+ } |
@gonsfx out of curiosity, how are you using |
@kangax I'm not using it at all, just found out that it can lead to leaks. |
on #2708 we are deleting it. |
If it doesn't (current state), the last instance is always leaked even after disposed and removed.
The text was updated successfully, but these errors were encountered: