summaryrefslogtreecommitdiffstats
path: root/tdeio
diff options
context:
space:
mode:
authorAlexander Golubev <fatzer2@gmail.com>2024-02-15 22:22:35 +0300
committerMichele Calgaro <michele.calgaro@yahoo.it>2024-02-16 18:35:30 +0900
commit63999d712676c3a044337a59050dc2dad3e2f6c8 (patch)
treeb2dfea1334feef239a900e226b88a678597b0af1 /tdeio
parent26274cb617a71706c0928489d0db959bb3d6589d (diff)
downloadtdelibs-63999d712676c3a044337a59050dc2dad3e2f6c8.tar.gz
tdelibs-63999d712676c3a044337a59050dc2dad3e2f6c8.zip
tdeio/kdirlister: add some cleanups for LocalURLJob's
Theoretically the lack of those could lead to segfaults and data corruptions, hard to debug but very rare. Signed-off-by: Alexander Golubev <fatzer2@gmail.com> (cherry picked from commit f34601e77a6960ffe67bef5436063fe3605987c6)
Diffstat (limited to 'tdeio')
-rw-r--r--tdeio/tdeio/kdirlister.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/tdeio/tdeio/kdirlister.cpp b/tdeio/tdeio/kdirlister.cpp
index bcebb93ee..c3fa3d451 100644
--- a/tdeio/tdeio/kdirlister.cpp
+++ b/tdeio/tdeio/kdirlister.cpp
@@ -1998,6 +1998,11 @@ void KDirLister::stop()
{
kdDebug(7003) << k_funcinfo << endl;
s_pCache->stop( this );
+ for( auto it = d->openURLContext.begin(); it != d->openURLContext.end(); ++it ) {
+ it.key()->disconnect( this );
+ it.key()->kill();
+ }
+ d->openURLContext.clear();
d->m_referenceURLMap.clear();
}
@@ -2005,6 +2010,17 @@ void KDirLister::stop( const KURL& _url )
{
kdDebug(7003) << k_funcinfo << _url.prettyURL() << endl;
s_pCache->stop( this, _url );
+ TQPtrList<TDEIO::Job> toRemove;
+ for( auto it = d->openURLContext.begin(); it != d->openURLContext.end(); ++it ) {
+ if( it.data().url ==_url ) {
+ it.key()->disconnect( this );
+ it.key()->kill();
+ toRemove.append(it.key());
+ }
+ }
+ for(const auto &job: toRemove) {
+ d->openURLContext.remove(job);
+ }
d->m_referenceURLMap.remove(_url.url());
}