https://bugs.kde.org/show_bug.cgi?id=521682

--- Comment #65 from Dolphin Whisperer <[email protected]> ---
orthogonaleety's root-cause analysis in comment 61/62
(https://invent.kde.org/orthogonaleety/discover/-/commit/89ad42afbd19e70d18a1aad1223ecb7704c32096)
is right, and the patch correctly calls `setSettingUp(false)` unconditionally —
but it doesn't actually fix the stuck spinner: `isFetchingUpdates()` reads a
*cached* value (`m_isFetchingUpdates.m_value`), which is only ever refreshed by
calling `EmitWhenChanged<bool>::reevaluate()`. The patch instead emits
`fetchingChanged()` directly, bypassing that recompute step entirely — so the
signal fires, but `isFetchingUpdates()` still returns the same stale cached
`true` afterward. `ResourcesUpdatesModel::refreshFetching()` re-reads
`isFetchingUpdates()` in response to the signal and sees the same stale value.

Fix: call `m_isFetchingUpdates.reevaluate()` instead (it emits
`fetchingChanged()` itself, but only after actually recomputing the value):

```cpp
void StandardBackendUpdater::refreshUpdateable()
{
    if (!m_backend->isValid()) {
        qWarning() << "Invalidated backend, deactivating" << m_backend->name();
        const bool wasSettingUp = m_settingUp;
        setSettingUp(false);
        if (wasSettingUp) {
            Q_EMIT progressingChanged(isProgressing());
        }
        m_isFetchingUpdates.reevaluate();
        return;
    }
    ...
```

I verified this with a regression test added to `DummyBackend`
(`testFetchingClearsAfterEarlyInvalidation`, simulating a backend that
invalidates before its updater ever completes setup — the same failure mode as
`FwupdBackend` under a masked `fwupd.service`):

- Unpatched master: FAIL — `fetchingChanged` never fires
- Patch from comment 61/62: FAIL — signal fires, but `isFetchingUpdates()` is
still `true`
- This patch: PASS

Anecdotally, on my machine (Fedora, patched build run uninstalled in its own
D-Bus session alongside the installed 6.7.3 package, same PackageKit daemon and
system state) the patched build showed "Up to date" where 6.7.3 stayed stuck —
consistent with the above but obviously not independently checkable by anyone
else.

Full diff (StandardBackendUpdater.cpp fix + DummyBackend test hook + regression
test) attached. Happy to open this as a proper MR if someone can point me at
the right target branch, or if a maintainer wants to take it from here given
the number of duplicates.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to