mirror of
https://github.com/gosticks/PaperWM.git
synced 2026-10-04 11:36:54 +00:00
Disconnect destroyed windows and actors
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user