diff options
| author | Amol Godbole <[email protected]> | 2023-09-04 00:24:38 -0500 |
|---|---|---|
| committer | Amol Godbole <[email protected]> | 2023-09-04 00:53:38 -0500 |
| commit | 9ba09040134f743ca3a2082589cc943c2d4bf175 (patch) | |
| tree | 694dfe04781e641487e83cbfdae4a4c67d25eefd | |
| parent | d7535d6977beb068d5ebf751278f585e9139c629 (diff) | |
KFileItemModel: Delay emitting currentDirectoryRemoved() signal
The KCoreDirLister object is modified before KCoreDirListerCache::deleteDir()
returns because the signal currentDirectoryRemoved() is emitted.
This prevents removal of the deleted lister from dirData.listersCurrentlyHolding
in KCoreDirListerCache::forgetDirs() when the tab is closed, which causes the
crash described in the bug. Hence, the signal currentDirectoryRemoved()
is delayed to ensure this does not occur.
BUG: 473377
| -rw-r--r-- | src/kitemviews/kfileitemmodel.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp index 40c76c7ef..f42f2c193 100644 --- a/src/kitemviews/kfileitemmodel.cpp +++ b/src/kitemviews/kfileitemmodel.cpp @@ -1197,7 +1197,12 @@ void KFileItemModel::slotItemsDeleted(const KFileItemList &items) for (const KFileItem &item : items) { if (item.url() == currentDir) { - Q_EMIT currentDirectoryRemoved(); + // #473377: Delay emitting currentDirectoryRemoved() to avoid modifying KCoreDirLister + // before KCoreDirListerCache::deleteDir() returns. + QTimer::singleShot(0, this, [this] { + Q_EMIT currentDirectoryRemoved(); + }); + return; } |
