Skip to content

Commit ca1779e

Browse files
committed
gwl: Properly disconnect state during destroy
2 parents 7f1863a + 8c2d0f8 commit ca1779e

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

files/usr/share/cinnamon/applets/[email protected]/appGroup.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class AppGroup {
8585
pressed: true
8686
});
8787

88-
this.groupState.connect({
88+
this.groupStateConnectionId = this.groupState.connect({
8989
isFavoriteApp: () => this.handleFavorite(true),
9090
getActor: () => this.actor,
9191
launchNewInstance: (...args) => this.launchNewInstance(...args),
@@ -1195,6 +1195,9 @@ class AppGroup {
11951195
}
11961196

11971197
destroy(skipRefCleanup) {
1198+
if (this.groupStateConnectionId) {
1199+
this.groupState.disconnect(this.groupStateConnectionId);
1200+
}
11981201
this.signals.disconnectAllSignals();
11991202
this.groupState.set({willUnmount: true});
12001203

files/usr/share/cinnamon/applets/[email protected]/applet.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ class GroupedWindowListApplet extends Applet.Applet {
207207
// applet to avoid passing down the parent class down the constructor chain and creating circular references.
208208
// In addition to manual event emitting, store.js can emit updates on property changes when set through
209209
// store.set. Any keys emitted through store.trigger that are not declared here first will throw an error.
210-
this.state.connect({
210+
this.stateConnectionId = this.state.connect({
211211
setSettingsValue: (k, v) => this.settings.setValue(k, v),
212212
getPanel: () => (this.panel ? this.panel : null),
213213
getPanelHeight: () => this._panelHeight,
@@ -427,6 +427,9 @@ class GroupedWindowListApplet extends Applet.Applet {
427427
workspace.destroy();
428428
}
429429
});
430+
if (this.stateConnectionId) {
431+
this.state.disconnect(this.stateConnectionId);
432+
}
430433
this.settings.finalize();
431434
unref(this, RESERVE_KEYS);
432435
MessageTray.extensionsHandlingNotifications--;

files/usr/share/cinnamon/applets/[email protected]/workspace.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const {RESERVE_KEYS} = require('./constants');
1010
class Workspace {
1111
constructor(params) {
1212
this.state = params.state;
13-
this.state.connect({
13+
this.stateConnectionId = this.state.connect({
1414
orientation: () => this.on_orientation_changed(false)
1515
});
1616
this.workspaceState = createStore({
@@ -420,6 +420,9 @@ class Workspace {
420420
}
421421

422422
destroy() {
423+
if (this.stateConnectionId) {
424+
this.state.disconnect(this.stateConnectionId);
425+
}
423426
this.signals.disconnectAllSignals();
424427
this.appGroups.forEach( appGroup => appGroup.destroy() );
425428
this.workspaceState.destroy();

0 commit comments

Comments
 (0)