Use _onDestroy() handlers for cleanup in delegates

Unify the style of <delegate>.destroy() methods to only contain a
call to <delegate>.actor.destroy() and handle additional cleanup
in a _onDestroy() signal handler.

https://bugzilla.gnome.org/show_bug.cgi?id=609454
This commit is contained in:
Florian Müllner
2010-02-18 16:43:58 +01:00
parent 0770fd5be5
commit 9f43ed3f95
3 changed files with 25 additions and 12 deletions

View File

@ -39,6 +39,8 @@ GenericWorkspacesView.prototype = {
this.actor = new St.Bin({ style_class: "workspaces" });
this._actor = new Clutter.Group();
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
this.actor.add_actor(this._actor);
this.actor.connect('style-changed', Lang.bind(this,
function() {
@ -181,13 +183,14 @@ GenericWorkspacesView.prototype = {
},
destroy: function() {
this.actor.destroy();
},
_onDestroy: function() {
for (let w = 0; w < this._workspaces.length; w++)
this._workspaces[w].destroy();
this._workspaces = [];
this.actor.destroy();
this.actor = null;
Main.overview.disconnect(this._overviewShowingId);
global.screen.disconnect(this._nWorkspacesNotifyId);
global.window_manager.disconnect(this._switchWorkspaceNotifyId);