diff options
| author | Sebastian Englbrecht <[email protected]> | 2026-05-23 17:38:44 +0200 |
|---|---|---|
| committer | Méven Car <[email protected]> | 2026-05-28 08:59:00 +0000 |
| commit | 8f7ab9d4b7ecc71083e2d7e03863857b1cfdea54 (patch) | |
| tree | 6eb5fab4fe50537cacc52bf253b80cc6386ca685 | |
| parent | 0d6302ef9be3387d3a62093ae18c92ec84e5a2e1 (diff) | |
dolphinplacesmodelsingleton,trash: destroy owned objects before KIO cache teardown
Both singletons start KIO list jobs on construction. Register
qAddPostRoutine to destroy the owned objects during QCoreApplication
teardown, while KIO's KCoreDirListerCache can still cancel in-flight jobs.
| -rw-r--r-- | src/dolphinplacesmodelsingleton.cpp | 5 | ||||
| -rw-r--r-- | src/trash/dolphintrash.cpp | 9 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/dolphinplacesmodelsingleton.cpp b/src/dolphinplacesmodelsingleton.cpp index 301150394..40fb930e4 100644 --- a/src/dolphinplacesmodelsingleton.cpp +++ b/src/dolphinplacesmodelsingleton.cpp @@ -10,6 +10,7 @@ #include <KAboutData> +#include <QCoreApplication> #include <QIcon> #include <QMimeData> @@ -120,6 +121,10 @@ bool DolphinPlacesModel::isTrash(const QModelIndex &index) const DolphinPlacesModelSingleton::DolphinPlacesModelSingleton() : m_placesModel(new DolphinPlacesModel()) { + // Destroy during QCoreApplication teardown, while KIO's KCoreDirListerCache is still alive. + qAddPostRoutine([] { + instance().m_placesModel.reset(); + }); } DolphinPlacesModelSingleton &DolphinPlacesModelSingleton::instance() diff --git a/src/trash/dolphintrash.cpp b/src/trash/dolphintrash.cpp index ae3f1e20c..66d69254a 100644 --- a/src/trash/dolphintrash.cpp +++ b/src/trash/dolphintrash.cpp @@ -16,6 +16,7 @@ #include <Solid/DeviceNotifier> #include <Solid/StorageAccess> +#include <QCoreApplication> #include <QList> Trash::Trash() @@ -53,6 +54,14 @@ Trash::Trash() }); m_trashDirLister->openUrl(QUrl(QStringLiteral("trash:/"))); + + // Destroy during QCoreApplication teardown, while KIO's KCoreDirListerCache is still alive. + // The singleton destructor fires later, but m_trashDirLister is already nullptr by then. + qAddPostRoutine([] { + auto &t = instance(); + delete t.m_trashDirLister; + t.m_trashDirLister = nullptr; + }); } Trash::~Trash() |
