mirror of
https://invent.kde.org/system/dolphin
synced 2024-10-03 23:29:06 +00:00
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
This commit is contained in:
parent
d7535d6977
commit
9ba0904013
|
@ -1197,7 +1197,12 @@ void KFileItemModel::slotItemsDeleted(const KFileItemList &items)
|
||||||
|
|
||||||
for (const KFileItem &item : items) {
|
for (const KFileItem &item : items) {
|
||||||
if (item.url() == currentDir) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue