Commit 799f26f4 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇
Browse files

Parent TasksModel to QGuiApplication and delete TasksModel after we've set the environment

`Settings` is a singleton and only cleaned up in `run_exit_handlers`, at which point
the QPA will already have cleaned up leading to a crash on teardown uner Wayland.

Also, there's no point in keeping it around, being subscribed to window management
changes, when we don't care about them anymore.


(cherry picked from commit 28d82c12)
parent d8673a6a
......@@ -113,7 +113,10 @@ const QMap<Settings::Environment, EnvironmentDescription> Settings::environmentD
Settings::Settings()
: AbstractBrowserPlugin(QStringLiteral("settings"), 1, nullptr)
, m_tasksModel(new TaskManager::WindowTasksModel(this))
// Settings is a singleton and cleaned up only in exit_handlers
// at which point the QPA will already have cleaned up
// leading to a crash on Wayland
, m_tasksModel(new TaskManager::WindowTasksModel(qGuiApp))
{
for (int i = 0; i < m_tasksModel->rowCount(); ++i) {
......@@ -236,7 +239,8 @@ bool Settings::setEnvironmentFromTasksModelIndex(const QModelIndex &idx)
qApp->setDesktopFileName(service->desktopEntryName());
qApp->setWindowIcon(QIcon::fromTheme(service->icon()));
disconnect(m_tasksModel, nullptr, this, nullptr);
m_tasksModel->deleteLater();
m_tasksModel = nullptr;
return true;
......
Supports Markdown
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