Public bug reported:

SUMMARY

[email protected] keeps this.webSearcher even when GNOME Shell
silently refuses to register it. Every subsequent disable() (screen lock,
suspend) then calls _unregisterProvider() with a provider that is not in the
provider list, which - due to a missing indexOf() === -1 guard in gnome-shell
(splice(-1, 1), reported upstream, link below) - silently removes the LAST
registered provider instead. One provider is destroyed per lock/unlock cycle.

Remote providers get re-registered by gnome-shell on installed-changed (snap
refreshes, .desktop rewrites), but the built-in 'applications' provider is
registered only once at shell startup. Once the lock/unlock cycles between two
reloads eat through the list and reach it, application search in the overview
is permanently broken for the session ("No results" for every installed app,
app grid still fine, nothing in the logs). Only re-login fixes it. The race
between suspend cycles and snap refreshes makes the breakage look random.

WHY REGISTRATION IS REFUSED

In extension.js:

    this.webSearcher = new WebSearcherSearchProvider(defaultBrowser, 
cancellable);
    this.searchResults._registerProvider(this.webSearcher);

_registerProvider() in gnome-shell silently returns without registering when
provider.appInfo fails shouldShowApp(), i.e. when appInfo.should_show() is
false. This happens in a perfectly common configuration: Google Chrome's deb
ships /usr/share/applications/com.google.Chrome.desktop with NoDisplay=true
(a google-chrome.desktop alias kept for XDG portal app-ID matching), and
"xdg-settings get default-web-browser" may point at that alias.

disable() then does:

    if (this.webSearcher) {
        this.searchResults._unregisterProvider(this.webSearcher);  // never 
registered -> splice(-1, 1)
        ...
    }

STEPS TO REPRODUCE

1. Ubuntu 26.04, google-chrome-stable installed from Google's deb.
2. xdg-settings set default-web-browser com.google.Chrome.desktop
3. In Looking Glass (Alt+F2, "lg"):
       Main.overview.searchController._searchResults._providers.map(p => 
p.id).join(' | ')
   Note the list.
4. Lock and unlock the screen; re-run the probe: the last provider is gone.
   Each lock/unlock removes one more.
5. Repeat until the list is down to 'applications'; one more lock/unlock and
   overview app search returns "No results" for everything until re-login.

SUGGESTED FIXES (any of these breaks the chain)

- After calling _registerProvider(), verify membership
  (this.searchResults._providers.includes(this.webSearcher)) and drop the
  reference if registration was refused; better, upstream _registerProvider()
  should return a boolean.
- Skip creating the provider when defaultBrowser.should_show() is false (same
  condition the shell uses to refuse it).
- Use the public API (Main.overview.searchController.addProvider/
  removeProvider) - note however that today it wraps the same unguarded
  private methods.

UPSTREAM

The missing indexOf === -1 guard in SearchResultsView._unregisterProvider() is
reported upstream: https://gitlab.gnome.org/GNOME/gnome-shell/-/work_items/9317

Both bugs are needed for the failure: the extension provides the stale
reference, gnome-shell turns it into the destruction of an arbitrary provider.
Fixing either one stops the data loss; fixing both is correct.

** Affects: gnome-shell-ubuntu-extensions (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2161811

Title:
  web-search-provider: stale provider reference when default browser has
  NoDisplay=true - destroys other search providers on every lock/unlock,
  eventually kills app search

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gnome-shell-ubuntu-extensions/+bug/2161811/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to