Skip to content

Commit

Permalink
Some deletion fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
xeolabs committed Mar 26, 2015
1 parent f180234 commit dea4e39
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/core/display/chunks/chunkFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ SceneJS_ChunkFactory.prototype.putChunk = function (chunk) {
chunk.recycle();
}

this._chunks[chunk.id] = null;
delete this._chunks[chunk.id];

var freeChunks = SceneJS_ChunkFactory._freeChunks[chunk.type];

Expand All @@ -140,7 +140,7 @@ SceneJS_ChunkFactory.prototype.webglRestored = function () {

chunk = this._chunks[chunkId]; // Re-cache chunk's shader variable locations

if (chunk.build) {
if (chunk && chunk.build) {
chunk.build();
}
}
Expand Down
8 changes: 6 additions & 2 deletions src/core/display/programFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ SceneJS_ProgramFactory.prototype.putProgram = function(program) {

SceneJS_ProgramSourceFactory.putSource(program.hash);

this._programs[program.hash] = null;
delete this._programs[program.hash];
}
};

Expand All @@ -54,10 +54,14 @@ SceneJS_ProgramFactory.prototype.putProgram = function(program) {
SceneJS_ProgramFactory.prototype.webglRestored = function() {

var gl = this._canvas.gl;
var program;

for (var id in this._programs) {
if (this._programs.hasOwnProperty(id)) {
this._programs[id].build(gl);
program = this._programs[id];
if (program && program.build) {
program.build(gl);
}
}
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/core/scene/coreFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ SceneJS_CoreFactory.prototype.putCore = function (core) {

var cores = this._cores[core.type];

cores[core.coreId] = null;
delete cores[core.coreId];

this._stateMap.removeItem(core.stateId); // Release state ID for reuse
}
Expand All @@ -161,7 +161,7 @@ SceneJS_CoreFactory.prototype.webglRestored = function () {

core = cores[coreId];

if (core.webglRestored) { // Method augmented on core by user
if (core && core.webglRestored) { // Method augmented on core by user
core.webglRestored();
}
}
Expand Down

0 comments on commit dea4e39

Please sign in to comment.