mirror of
https://github.com/edu4rdshl/gnome-shell.git
synced 2026-07-17 23:24:51 +00:00
status/volume: Always look up device objects
Gvc may clean its device cache after we set up the device menu,
which can lead to failed assertions when using the "old" object
to later switch the device from a callback.
Make sure this doesn't happen by looking up the ID again from
the callback.
Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7173
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3011>
(cherry picked from commit 7a04d92bc0)
This commit is contained in:
parent
e8cdf361a4
commit
d4e5ec0bac
1 changed files with 7 additions and 1 deletions
|
|
@ -134,7 +134,13 @@ const StreamSlider = GObject.registerClass({
|
|||
? `${description} – ${origin}`
|
||||
: description;
|
||||
const item = new PopupMenu.PopupImageMenuItem(name, device.get_gicon());
|
||||
item.connect('activate', () => this._activateDevice(device));
|
||||
item.connect('activate', () => {
|
||||
const dev = this._lookupDevice(id);
|
||||
if (dev)
|
||||
this._activateDevice(dev);
|
||||
else
|
||||
console.warn(`Trying to activate invalid device ${id}`);
|
||||
});
|
||||
|
||||
this._deviceSection.addMenuItem(item);
|
||||
this._deviceItems.set(id, item);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue