mirror of
https://github.com/morgan9e/dash-to-panel
synced 2026-04-15 00:34:05 +09:00
Fixed some memory leaks and Work ID issue
This commit is contained in:
@@ -63,19 +63,19 @@ const thumbnailPreviewMenu = new Lang.Class({
|
|||||||
this.actor.hide();
|
this.actor.hide();
|
||||||
|
|
||||||
// Chain our visibility and lifecycle to that of the source
|
// Chain our visibility and lifecycle to that of the source
|
||||||
source.actor.connect('notify::mapped', Lang.bind(this, function () {
|
this._mappedId = this._source.actor.connect('notify::mapped', Lang.bind(this, function () {
|
||||||
if (!source.actor.mapped)
|
if (!this._source.actor.mapped)
|
||||||
this.close();
|
this.close();
|
||||||
}));
|
}));
|
||||||
source.actor.connect('destroy', Lang.bind(this, this.destroy));
|
this._destroyId = this._source.actor.connect('destroy', Lang.bind(this, this.destroy));
|
||||||
|
|
||||||
Main.uiGroup.add_actor(this.actor);
|
Main.uiGroup.add_actor(this.actor);
|
||||||
|
|
||||||
source.actor.connect('enter-event', Lang.bind(this, this._onEnter));
|
this._enterSourceId = this._source.actor.connect('enter-event', Lang.bind(this, this._onEnter));
|
||||||
source.actor.connect('leave-event', Lang.bind(this, this._onLeave));
|
this._leaveSourceId = this._source.actor.connect('leave-event', Lang.bind(this, this._onLeave));
|
||||||
|
|
||||||
this.actor.connect('enter-event', Lang.bind(this, this._onMenuEnter));
|
this._enterMenuId = this.actor.connect('enter-event', Lang.bind(this, this._onMenuEnter));
|
||||||
this.actor.connect('leave-event', Lang.bind(this, this._onMenuLeave));
|
this._leaveMenuId = this.actor.connect('leave-event', Lang.bind(this, this._onMenuLeave));
|
||||||
|
|
||||||
// Change the initialized side where required.
|
// Change the initialized side where required.
|
||||||
this._arrowSide = side;
|
this._arrowSide = side;
|
||||||
@@ -144,6 +144,26 @@ const thumbnailPreviewMenu = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
destroy: function () {
|
||||||
|
if (this._mappedId)
|
||||||
|
this._source.actor.disconnect(this._mappedId);
|
||||||
|
|
||||||
|
if (this._destroyId)
|
||||||
|
this._source.actor.disconnect(this._destroyId);
|
||||||
|
|
||||||
|
if (this._enterSourceId)
|
||||||
|
this._source.actor.disconnect(this._enterSourceId);
|
||||||
|
if (this._leaveSourceId)
|
||||||
|
this._source.actor.disconnect(this._leaveSourceId);
|
||||||
|
|
||||||
|
if (this._enterMenuId)
|
||||||
|
this.actor.disconnect(this._enterMenuId);
|
||||||
|
if (this._leaveMenuId)
|
||||||
|
this.actor.disconnect(this._leaveMenuId);
|
||||||
|
|
||||||
|
this.parent();
|
||||||
|
},
|
||||||
|
|
||||||
close: function(animate) {
|
close: function(animate) {
|
||||||
if (this.isOpen)
|
if (this.isOpen)
|
||||||
this.emit('open-state-changed', false);
|
this.emit('open-state-changed', false);
|
||||||
@@ -155,7 +175,7 @@ const thumbnailPreviewMenu = new Lang.Class({
|
|||||||
this.emit('menu-closed');
|
this.emit('menu-closed');
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.isOpen = false;
|
this.isOpen = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -417,6 +437,7 @@ const thumbnailPreviewList = new Lang.Class({
|
|||||||
this._stateChangedId = 0;
|
this._stateChangedId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
|
||||||
this._stateChangedId = this.app.connect('windows-changed',
|
this._stateChangedId = this.app.connect('windows-changed',
|
||||||
Lang.bind(this,
|
Lang.bind(this,
|
||||||
this._queueRedisplay));
|
this._queueRedisplay));
|
||||||
@@ -506,6 +527,11 @@ const thumbnailPreviewList = new Lang.Class({
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_onDestroy: function() {
|
||||||
|
this.app.disconnect(this._stateChangedId);
|
||||||
|
this._stateChangedId = 0;
|
||||||
|
},
|
||||||
|
|
||||||
_createPreviewItem: function(window) {
|
_createPreviewItem: function(window) {
|
||||||
let preview = new thumbnailPreview(window);
|
let preview = new thumbnailPreview(window);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user