Commit f55fd33c authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

Flatpak: Make sure we cancel ongoing transactions on shutdown

Otherwise they may stay dangling, leading to a crash.

BUG: 396730
parent 8303e5d1
......@@ -101,6 +101,7 @@ FlatpakBackend::FlatpakBackend(QObject* parent)
FlatpakBackend::~FlatpakBackend()
{
g_cancellable_cancel(m_cancellable);
m_threadPool.clear();
for(auto inst : m_installations)
g_object_unref(inst);
......@@ -733,10 +734,9 @@ void FlatpakBackend::loadLocalUpdates(FlatpakInstallation *flatpakInstallation)
void FlatpakBackend::loadRemoteUpdates(FlatpakInstallation* installation)
{
auto fw = new QFutureWatcher<GPtrArray *>(this);
fw->setFuture(QtConcurrent::run(&m_threadPool, [installation]() -> GPtrArray * {
g_autoptr(GCancellable) cancellable = g_cancellable_new();
fw->setFuture(QtConcurrent::run(&m_threadPool, [installation, this]() -> GPtrArray * {
g_autoptr(GError) localError = nullptr;
GPtrArray *refs = flatpak_installation_list_installed_refs_for_update(installation, cancellable, &localError);
GPtrArray *refs = flatpak_installation_list_installed_refs_for_update(installation, m_cancellable, &localError);
if (!refs) {
qWarning() << "Failed to get list of installed refs for listing updates: " << localError->message;
}
......
Markdown is supported
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