Disconnect destroyed windows and actors

This commit is contained in:
Tor Hedin Brønner
2018-07-02 18:28:25 +02:00
parent 8c758c2ca2
commit ea77c4609f
2 changed files with 17 additions and 0 deletions
+9
View File
@@ -826,6 +826,12 @@ function registerWindow(metaWindow) {
signals.connect(metaWindow, 'notify::fullscreen', fullscreenWrapper);
signals.connect(metaWindow, 'size-changed', resizeHandler);
signals.connect(actor, 'show', showWrapper);
signals.connect(actor, 'destroy', destroyHandler);
}
function destroyHandler(actor) {
signals.disconnect(actor);
}
function cloneSizeHandler(metaWindow) {
@@ -979,6 +985,9 @@ function remove_handler(workspace, meta_window) {
return;
space.layout();
if (!meta_window.get_compositor_private())
signals.disconnect(meta_window);
// (could be an empty workspace)
if (space.selectedWindow) {
// Force a new ensure, since the focus_handler is run before
+8
View File
@@ -169,6 +169,14 @@ class Signals extends Map {
signals.push(object.connect(signal, handler));
}
disconnect(object) {
let ids = this.get(object);
if (ids) {
ids.forEach(id => object.disconnect(id));
this.delete(object);
}
}
destroy() {
for (let [object, signals] of this) {
signals.forEach(id => object.disconnect(id));