Skip to content

Commit 8c2d0f8

Browse files
committed
Properly disconnect from local state signals to avoid errors during applet reload
1 parent e8752bb commit 8c2d0f8

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),
@@ -1208,6 +1208,9 @@ class AppGroup {
12081208
}
12091209

12101210
destroy(skipRefCleanup) {
1211+
if (this.groupStateConnectionId) {
1212+
this.groupState.disconnect(this.groupStateConnectionId);
1213+
}
12111214
this.signals.disconnectAllSignals();
12121215
this.groupState.set({willUnmount: true});
12131216

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,
@@ -426,6 +426,9 @@ class GroupedWindowListApplet extends Applet.Applet {
426426
workspace.destroy();
427427
}
428428
});
429+
if (this.stateConnectionId) {
430+
this.state.disconnect(this.stateConnectionId);
431+
}
429432
this.settings.finalize();
430433
unref(this, RESERVE_KEYS);
431434
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)