Skip to content

Commit

Permalink
Prevent dispatcher from firing callbacks after removed
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Wojciechowski committed Jul 12, 2016
1 parent 5c7774c commit ff07754
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion js/data/buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Buffer.prototype.setVertexAttribPointers = function(gl, program) {
* @param gl The WebGL context
*/
Buffer.prototype.destroy = function(gl) {
if (gl && this.buffer) {
if (this.buffer) {
gl.deleteBuffer(this.buffer);
}
};
Expand Down
2 changes: 1 addition & 1 deletion js/render/vertex_array_object.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ VertexArrayObject.prototype.unbind = function(gl) {
};

VertexArrayObject.prototype.destroy = function(gl) {
var ext = gl && gl.extVertexArrayObject;
var ext = gl.extVertexArrayObject;
if (ext && this.vao) {
ext.deleteVertexArrayOES(this.vao);
this.vao = null;
Expand Down
9 changes: 5 additions & 4 deletions js/util/dispatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ function Dispatcher(length, parent) {

this.worker = new Worker(workerBus);
this.actor = new Actor(parentBus, parent);

this.remove = function() {
parentListeners.splice(0, parentListeners.length);
workerListeners.splice(0, workerListeners.length);
};
}

Dispatcher.prototype = {
Expand All @@ -45,9 +50,5 @@ Dispatcher.prototype = {

send: function(type, data, callback, targetID, buffers) {
this.actor.send(type, data, callback, buffers);
},

remove: function() {
// noop
}
};

0 comments on commit ff07754

Please sign in to comment.