summaryrefslogtreecommitdiffstats
path: root/tdeio
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-04-23 00:15:42 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-04-23 00:15:42 -0500
commit8188a65884ac1bca0aea32c5fdbaa19bc3b868f0 (patch)
tree6cbce1073ebf0554d81c9a7be32486fd6ef5bbbf /tdeio
parent7217eca58605fb57b4dd0ffcd7ca4445681ce619 (diff)
downloadtdelibs-8188a65884ac1bca0aea32c5fdbaa19bc3b868f0.tar.gz
tdelibs-8188a65884ac1bca0aea32c5fdbaa19bc3b868f0.zip
Fix kdirlister crash
This resolves Bug 1476
Diffstat (limited to 'tdeio')
-rw-r--r--tdeio/tdeio/kdirlister.cpp20
-rw-r--r--tdeio/tdeio/tdefileitem.cpp18
2 files changed, 26 insertions, 12 deletions
diff --git a/tdeio/tdeio/kdirlister.cpp b/tdeio/tdeio/kdirlister.cpp
index 91f025013..1bf9ac78c 100644
--- a/tdeio/tdeio/kdirlister.cpp
+++ b/tdeio/tdeio/kdirlister.cpp
@@ -334,12 +334,15 @@ void KDirListerCache::stop( KDirLister *lister )
TQDictIterator< TQPtrList<KDirLister> > it( urlsCurrentlyListed );
TQPtrList<KDirLister> *listers;
+ int curIndex;
while ( (listers = it.current()) )
{
- if ( listers->findRef( lister ) > -1 )
+ curIndex = listers->findRef( lister );
+ if ( curIndex > -1 )
{
// lister is listing url
TQString url = it.currentKey();
+ KDirLister* curLister = listers->at( curIndex );
//kdDebug(7004) << k_funcinfo << " found lister in list - for " << url << endl;
bool ret = listers->removeRef( lister );
@@ -360,15 +363,16 @@ void KDirListerCache::stop( KDirLister *lister )
holders->append( lister );
- emit lister->canceled( KURL( url ) );
+ emit lister->canceled( curLister->d->url );
//kdDebug(7004) << k_funcinfo << "remaining list: " << listers->count() << " listers" << endl;
if ( listers->isEmpty() )
{
// kill the job since it isn't used any more
- if ( job )
+ if ( job ) {
killJob( job );
+ }
urlsCurrentlyListed.remove( url );
}
@@ -414,8 +418,9 @@ void KDirListerCache::stop( KDirLister *lister, const KURL& _u )
TDEIO::ListJob *job = jobForUrl( urlStr + ":" + urlReferenceStr );
- if ( job )
+ if ( job ) {
lister->jobDone( job );
+ }
emit lister->canceled( _url );
@@ -1255,8 +1260,9 @@ void KDirListerCache::slotRedirection( TDEIO::Job *j, const KURL& url )
for ( KDirLister *kdl = listers->first(); kdl; kdl = listers->next() )
curListers->append( kdl );
}
- else
+ else {
urlsCurrentlyListed.insert( newUrl.url() + ":" + newUrl.internalReferenceURL(), listers );
+ }
if ( oldJob ) // kill the old job, be it a list-job or an update-job
killJob( oldJob );
@@ -1726,8 +1732,10 @@ TDEIO::ListJob *KDirListerCache::jobForUrl( const TQString& url, TDEIO::ListJob
while ( it != jobs.end() )
{
job = it.key();
- if ( joburl( job ).url(-1) == url && job != not_job )
+ KURL itjoburl = joburl( job );
+ if ( ((itjoburl.url(-1) + ":" + itjoburl.internalReferenceURL()) == url) && (job != not_job) ) {
return job;
+ }
++it;
}
return 0;
diff --git a/tdeio/tdeio/tdefileitem.cpp b/tdeio/tdeio/tdefileitem.cpp
index fd07794cc..071153208 100644
--- a/tdeio/tdeio/tdefileitem.cpp
+++ b/tdeio/tdeio/tdefileitem.cpp
@@ -108,8 +108,9 @@ KFileItem::KFileItem( const KURL &url, const TQString &mimeType, mode_t mode )
m_hidden( Auto ),
d(0)
{
- if (m_bMimeTypeKnown)
+ if (m_bMimeTypeKnown) {
m_pMimeType = KMimeType::mimeType( mimeType );
+ }
init( false );
}
@@ -136,8 +137,9 @@ void KFileItem::init( bool _determineMimeTypeOnDemand )
m_access = TQString::null;
m_size = (TDEIO::filesize_t) -1;
// metaInfo = KFileMetaInfo();
- for ( int i = 0; i < NumFlags; i++ )
+ for ( int i = 0; i < NumFlags; i++ ) {
m_time[i] = (time_t) -1;
+ }
// determine mode and/or permissions if unknown
if ( m_fileMode == KFileItem::Unknown || m_permissions == KFileItem::Unknown )
@@ -160,18 +162,22 @@ void KFileItem::init( bool _determineMimeTypeOnDemand )
if ( S_ISLNK( mode ) )
{
m_bLink = true;
- if ( KDE_stat( path.data(), &buf ) == 0 )
+ if ( KDE_stat( path.data(), &buf ) == 0 ) {
mode = buf.st_mode;
- else // link pointing to nowhere (see tdeio/file/file.cc)
+ }
+ else { // link pointing to nowhere (see tdeio/file/file.cc)
mode = (S_IFMT-1) | S_IRWXU | S_IRWXG | S_IRWXO;
+ }
}
// While we're at it, store the times
m_time[ Modification ] = buf.st_mtime;
m_time[ Access ] = buf.st_atime;
- if ( m_fileMode == KFileItem::Unknown )
+ if ( m_fileMode == KFileItem::Unknown ) {
m_fileMode = mode & S_IFMT; // extract file type
- if ( m_permissions == KFileItem::Unknown )
+ }
+ if ( m_permissions == KFileItem::Unknown ) {
m_permissions = mode & 07777; // extract permissions
+ }
}
}
}