ensure screen and program globals are reset.

This commit is contained in:
Christopher Jeffrey 2015-08-05 05:02:37 -07:00
parent 8007aa8ee7
commit 0d86165122
2 changed files with 8 additions and 0 deletions

View File

@ -446,6 +446,10 @@ Program.prototype.destroy = function() {
this.flush();
this._exiting = true;
if (Program.total === 1) {
Program.global = Program.instances[0];
}
if (Program.total === 0) {
Program.global = null;

View File

@ -391,6 +391,10 @@ Screen.prototype.destroy = function() {
Screen.instances.splice(index, 1);
Screen.total--;
if (Screen.total === 1) {
Screen.global = Screen.instances[0];
}
if (Screen.total === 0) {
Screen.global = null;