[sushi] all: stop using delete to track objects/timeouts
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sushi] all: stop using delete to track objects/timeouts
- Date: Mon, 19 Mar 2012 20:40:58 +0000 (UTC)
commit 0d228665461dba74016475146b5c1d8250c285bf
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Mon Mar 19 16:38:19 2012 -0400
all: stop using delete to track objects/timeouts
Just set them to null/zero instead, which is the convention we use
everywhere else.
src/js/ui/mainWindow.js | 20 +++++++++++++-------
src/js/ui/spinnerBox.js | 11 +++++++----
src/js/viewers/evince.js | 8 ++++++--
3 files changed, 26 insertions(+), 13 deletions(-)
---
diff --git a/src/js/ui/mainWindow.js b/src/js/ui/mainWindow.js
index 52dc1a0..0ac109c 100644
--- a/src/js/ui/mainWindow.js
+++ b/src/js/ui/mainWindow.js
@@ -55,8 +55,14 @@ MainWindow.prototype = {
_init : function(args) {
args = args || {};
+ this._background = null;
+ this._pendingRenderer = null;
+ this._renderer = null;
+ this._texture = null;
this._toolbarActor = null;
+ this._fullScreenId = 0;
this._toolbarId = 0;
+ this._unFullScreenId = 0;
this._mimeHandler = new MimeHandler.MimeHandler();
@@ -273,7 +279,7 @@ MainWindow.prototype = {
if (this._renderer.clear)
this._renderer.clear();
- delete this._renderer;
+ this._renderer = null;
}
/* create a temporary spinner renderer, that will timeout and show itself
@@ -306,7 +312,7 @@ MainWindow.prototype = {
this._renderer.destroy();
this._renderer = this._pendingRenderer;
- delete this._pendingRenderer;
+ this._pendingRenderer = null;
/* generate the texture and toolbar for the new renderer */
this._createTexture();
@@ -316,7 +322,7 @@ MainWindow.prototype = {
_createTexture : function() {
if (this._texture) {
this._texture.destroy();
- delete this._texture;
+ this._texture = null;
}
this._texture = this._renderer.render();
@@ -341,11 +347,11 @@ MainWindow.prototype = {
**************************************************************************/
_onStageUnFullScreen : function() {
this._stage.disconnect(this._unFullScreenId);
- delete this._unFullScreenId;
+ this._unFullScreenId = 0;
/* We want the alpha background back now */
this._background.destroy();
- delete this._background;
+ this._background = null;
this._createAlphaBackground();
this._textureYAlign.factor = this._savedYFactor;
@@ -397,11 +403,11 @@ MainWindow.prototype = {
_onStageFullScreen : function() {
this._stage.disconnect(this._fullScreenId);
- delete this._fullScreenId;
+ this._fullScreenId = 0;
/* We want a solid black background */
this._background.destroy();
- delete this._background;
+ this._background = null;
this._createSolidBackground();
/* Fade in everything but the title */
diff --git a/src/js/ui/spinnerBox.js b/src/js/ui/spinnerBox.js
index 97ff6a7..3719723 100644
--- a/src/js/ui/spinnerBox.js
+++ b/src/js/ui/spinnerBox.js
@@ -36,12 +36,15 @@ let TIMEOUT = 500;
function SpinnerBox(args) {
this._init(args);
- this.canFullScreen = false;
- this.moveOnClick = true;
}
SpinnerBox.prototype = {
_init : function(args) {
+ this._timeoutId = 0;
+
+ this.canFullScreen = false;
+ this.moveOnClick = true;
+
this._spinnerBox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 12);
this._spinnerBox.show();
@@ -82,7 +85,7 @@ SpinnerBox.prototype = {
destroy : function() {
if (this._timeoutId) {
Mainloop.source_remove(this._timeoutId);
- delete this._timeoutId;
+ this._timeoutId = 0;
}
Tweener.addTween(this.actor,
@@ -97,7 +100,7 @@ SpinnerBox.prototype = {
},
_onTimeoutCompleted : function() {
- delete this._timeoutId;
+ this._timeoutId = 0;
Tweener.addTween(this.actor,
{ opacity: 255,
diff --git a/src/js/viewers/evince.js b/src/js/viewers/evince.js
index 3d4acf6..36cf5e5 100644
--- a/src/js/viewers/evince.js
+++ b/src/js/viewers/evince.js
@@ -44,6 +44,10 @@ function EvinceRenderer(args) {
EvinceRenderer.prototype = {
_init : function(args) {
EvDoc.init();
+
+ this._pdfLoader = null;
+ this._document = null;
+
this.moveOnClick = false;
this.canFullScreen = true;
},
@@ -167,8 +171,8 @@ EvinceRenderer.prototype = {
clear : function() {
this._pdfLoader.cleanup_document();
- delete this._document;
- delete this._pdfLoader;
+ this._document = null;
+ this._pdfLoader = null;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]