Skip to content
Commit 107716c0 authored by Harald Sitter's avatar Harald Sitter 🐧
Browse files

packagekit: hold stream in a qpointer

there is a very awkward race condition involving streams during
initialization. if any of the (KNS) backends fail to initialize and
become invalid they will eventually trigger
`ResourcesModel::callerFetchingChanged` which will discard the now
invalid backends and emit `backendsChanged` which will trigger
`ResourcesProxyModel::invalidateFilter` which then may end up deleting
the current stream

```
    if (m_currentStream) {
qCWarning(LIBDISCOVER_LOG) << "last stream isn't over yet" <<
m_filters << this;
        delete m_currentStream;
```

this is in so far problematic as we "schedule" lambda executions in the
packagekit backend (most prominently in `PackageKitBackend::search`)
with lambdas that hold the stream. these lambdas will eventually run on
since-deleted stream objects and best case fall into a nullptr but more
regularly just fall into a ditch of random memory until undefined
behavior bites us

BUG: 467888
BUG: 465711
BUG: 473921
(cherry picked from commit 2e52e7c9)
parent 8e5db81f
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment