Skip to content

Commit 9305dc6

Browse files
committed
Properly disconnect from local state signals to avoid errors during applet reload
1 parent 73f873d commit 9305dc6

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
@@ -86,7 +86,7 @@ var AppGroup = class AppGroup {
8686
pressed: true
8787
});
8888

89-
this.groupState.connect({
89+
this.groupStateConnectionId = this.groupState.connect({
9090
isFavoriteApp: () => this.handleFavorite(true),
9191
getActor: () => this.actor,
9292
launchNewInstance: (...args) => this.launchNewInstance(...args),
@@ -1196,6 +1196,9 @@ var AppGroup = class AppGroup {
11961196
}
11971197

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

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ class GroupedWindowListApplet extends Applet.Applet {
208208
// applet to avoid passing down the parent class down the constructor chain and creating circular references.
209209
// In addition to manual event emitting, store.js can emit updates on property changes when set through
210210
// store.set. Any keys emitted through store.trigger that are not declared here first will throw an error.
211-
this.state.connect({
211+
this.stateConnectionId = this.state.connect({
212212
setSettingsValue: (k, v) => this.settings.setValue(k, v),
213213
getPanel: () => (this.panel ? this.panel : null),
214214
getPanelHeight: () => this._panelHeight,
@@ -428,6 +428,9 @@ class GroupedWindowListApplet extends Applet.Applet {
428428
workspace.destroy();
429429
}
430430
});
431+
if (this.stateConnectionId) {
432+
this.state.disconnect(this.stateConnectionId);
433+
}
431434
this.settings.finalize();
432435
unref(this, RESERVE_KEYS);
433436
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
@@ -11,7 +11,7 @@ const {RESERVE_KEYS} = Me.imports.constants;
1111
var Workspace = class Workspace {
1212
constructor(params) {
1313
this.state = params.state;
14-
this.state.connect({
14+
this.stateConnectionId = this.state.connect({
1515
orientation: () => this.on_orientation_changed(false)
1616
});
1717
this.workspaceState = createStore({
@@ -421,6 +421,9 @@ var Workspace = class Workspace {
421421
}
422422

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

0 commit comments

Comments
 (0)