FIx memory leak on model rendering (#1695)

FIx memory leak on model rendering
10.7.0-preview
Michael Keller 2019-09-29 16:02:10 +13:00 committed by GitHub
commit b4f9f343d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 0 deletions

View File

@ -144,3 +144,8 @@ Model.prototype.resize = function () {
this.render();
};
Model.prototype.dispose = function () {
this.renderer.forceContextLoss();
this.renderer.dispose();
};

View File

@ -1729,6 +1729,7 @@ TABS.pid_tuning.cleanup = function (callback) {
if (self.model) {
$(window).off('resize', $.proxy(self.model.resize, self.model));
self.model.dispose();
}
$(window).off('resize', $.proxy(this.updateRatesLabels, this));

View File

@ -605,6 +605,7 @@ TABS.receiver.cleanup = function (callback) {
$(window).off('resize', this.resize);
if (this.model) {
$(window).off('resize', $.proxy(this.model.resize, this.model));
this.model.dispose();
}
this.keepRendering = false;

View File

@ -341,6 +341,7 @@ TABS.setup.renderModel = function () {
TABS.setup.cleanup = function (callback) {
if (this.model) {
$(window).off('resize', $.proxy(this.model.resize, this.model));
this.model.dispose();
}
if (callback) callback();