Skip to content

Commit

Permalink
properly null out and remove ml sources
Browse files Browse the repository at this point in the history
  • Loading branch information
sakithb committed Jan 16, 2024
1 parent 6b196f9 commit ed021cf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@ export default class MediaControls extends Extension {

private removePlayer(busName: string) {
debugLog("Removing player:", busName);
this.playerProxies.get(busName)?.onDestroy();
this.playerProxies.delete(busName);
this.panelBtn?.updateWidgets(WidgetFlags.MENU_PLAYERS);
this.setActivePlayer();
Expand Down
6 changes: 6 additions & 0 deletions src/helpers/shell/PlayerProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,4 +385,10 @@ export default class PlayerProxy {

listeners.splice(id, 1);
}

public onDestroy() {
if (this.pollSourceId != null) {
GLib.source_remove(this.pollSourceId);
}
}
}
6 changes: 6 additions & 0 deletions src/prefs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ export default class MediaControlsPreferences extends ExtensionPreferences {
this.window = null;
this.settings = null;
this.builder = null;

this.generalPage = null;
this.panelPage = null;
this.positionsPage = null;
this.shortcutsPage = null;
this.otherPage = null;
});
}

Expand Down

0 comments on commit ed021cf

Please sign in to comment.