Skip to content

Commit edf7828

Browse files
authored
Avoid duplicate background app entries (#594)
Fixes #593 Fixes #495 This bug is in Flatpak background monitor when it fails to identify which desktop file belongs to which app. I explained it a while ago here: #516 (comment)
1 parent bf4132f commit edf7828

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/AppSystem/Background/BackgroundMonitor.vala

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,21 @@ public class Dock.BackgroundMonitor : Object {
4040
}
4141

4242
private void update_background_apps () {
43+
var app_id_set = new GLib.GenericSet<unowned string> (GLib.str_hash, GLib.str_equal, null);
4344
BackgroundApp[] apps = {};
4445

4546
foreach (var table in proxy.background_apps) {
4647
DesktopAppInfo? app_info = null;
4748
if ("app_id" in table) {
48-
app_info = new DesktopAppInfo ((string) table["app_id"] + ".desktop");
49+
unowned var app_id = table["app_id"].get_string ();
50+
51+
if (app_id in app_id_set) {
52+
// avoid duplicate entries
53+
continue;
54+
}
55+
56+
app_info = new DesktopAppInfo (app_id + ".desktop");
57+
app_id_set.add (app_id);
4958
}
5059

5160
if (app_info == null) {

0 commit comments

Comments
 (0)