Skip to content

hold stream in a qpointer

Harald Sitter requested to merge work/sitter/thyshaltnotcrash into master

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

Merge request reports

Loading