Summary: | crash during podcast download [@ SqlPodcastProvider::checkEnclosureLocallyAvailable] | ||
---|---|---|---|
Product: | [Applications] amarok | Reporter: | Ritesh Raj Sarraf <kde-bugs> |
Component: | Podcast | Assignee: | Amarok Developers <amarok-bugs-dist> |
Status: | RESOLVED FIXED | ||
Severity: | crash | CC: | annemarievictor, arne.schmitz, bart.cerneels, Bruno.Cauville, hardysmiles, johnkinell, mail, mattias, moritz-kdebugs, tim, yrona |
Priority: | NOR | ||
Version: | 2.3.0 | ||
Target Milestone: | --- | ||
Platform: | Debian testing | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | 2.3.1 | |
Sentry Crash Report: |
Description
Ritesh Raj Sarraf
2010-03-16 08:57:51 UTC
*** Bug 231016 has been marked as a duplicate of this bug. *** Confirmed by duplicate commit c654f9ebeea978fdac50240711a3e927ac050fa4 Author: Bart Cerneels <bart.cerneels@kde.org> Date: Wed Mar 17 20:27:28 2010 +0100 Use of ksharedptr prevents dangling pointers. BUG:230932 diff --git a/src/podcasts/sql/SqlPodcastProvider.cpp b/src/podcasts/sql/SqlPodcastProvider.cpp index 2f37c57..9181183 100644 --- a/src/podcasts/sql/SqlPodcastProvider.cpp +++ b/src/podcasts/sql/SqlPodcastProvider.cpp @@ -968,7 +968,7 @@ SqlPodcastProvider::downloadEpisode( Meta::SqlPodcastEpisodePtr sqlEpisode ) return; } - if( m_downloadJobMap.values().contains( sqlEpisode.data() ) ) + if( m_downloadJobMap.values().contains( sqlEpisode ) ) { debug() << "already downloading " << sqlEpisode->uidUrl(); return; @@ -988,7 +988,7 @@ SqlPodcastProvider::downloadEpisode( Meta::SqlPodcastEpisodePtr sqlEpisode ) KIO::TransferJob *transferJob = KIO::get( sqlEpisode->uidUrl(), KIO::Reload, KIO::HideProgressInfo ); - m_downloadJobMap[transferJob] = sqlEpisode.data(); + m_downloadJobMap[transferJob] = sqlEpisode; m_fileNameMap[transferJob] = KUrl( sqlEpisode->uidUrl() ).fileName(); debug() << "starting download for " << sqlEpisode->title() @@ -1041,15 +1041,15 @@ SqlPodcastProvider::createTmpFile( KJob *job ) { DEBUG_BLOCK - Meta::SqlPodcastEpisode *sqlEpisode = m_downloadJobMap.value( job ); - if( sqlEpisode == 0 ) + Meta::SqlPodcastEpisodePtr sqlEpisode = m_downloadJobMap.value( job ); + if( sqlEpisode.isNull() ) { error() << "sqlEpisodePtr is NULL after download"; return 0; } Meta::SqlPodcastChannelPtr sqlChannel = Meta::SqlPodcastChannelPtr::dynamicCast( sqlEpisode->channel() ); - if( !sqlChannel ) + if( sqlChannel.isNull() ) { error() << "sqlChannelPtr is NULL after download"; return 0; @@ -1080,15 +1080,15 @@ SqlPodcastProvider::createTmpFile( KJob *job ) bool SqlPodcastProvider::checkEnclosureLocallyAvailable( KIO::Job *job ) { - Meta::SqlPodcastEpisode *sqlEpisode = m_downloadJobMap.value( job ); - if( sqlEpisode == 0 ) + Meta::SqlPodcastEpisodePtr sqlEpisode = m_downloadJobMap.value( job ); + if( sqlEpisode.isNull() ) { error() << "sqlEpisodePtr is NULL after download"; return false; } Meta::SqlPodcastChannelPtr sqlChannel = Meta::SqlPodcastChannelPtr::dynamicCast( sqlEpisode->channel() ); - if( !sqlChannel ) + if( sqlChannel.isNull() ) { error() << "sqlChannelPtr is NULL after download"; return false; @@ -1098,14 +1098,12 @@ SqlPodcastProvider::checkEnclosureLocallyAvailable( KIO::Job *job ) fileName += m_fileNameMap.value( job ); debug() << "checking " << fileName; QFileInfo fileInfo( fileName ); - if ( !fileInfo.exists() ) - { + if( !fileInfo.exists() ) return false; - } debug() << fileName << " already exists, no need to redownload"; // NOTE: we need to emit because the KJobProgressBar relies on it to clean up - job->kill(KJob::EmitResult); + job->kill( KJob::EmitResult ); sqlEpisode->setLocalUrl( fileName ); emit( updated() ); // repaint icons return true; @@ -1185,8 +1183,8 @@ SqlPodcastProvider::downloadResult( KJob *job ) } else { - Meta::SqlPodcastEpisode *sqlEpisode = m_downloadJobMap.value( job ); - if( sqlEpisode == 0 ) + Meta::SqlPodcastEpisodePtr sqlEpisode = m_downloadJobMap.value( job ); + if( sqlEpisode.isNull() ) { error() << "sqlEpisodePtr is NULL after download"; cleanupDownload( job, true ); @@ -1194,7 +1192,7 @@ SqlPodcastProvider::downloadResult( KJob *job ) } Meta::SqlPodcastChannelPtr sqlChannel = Meta::SqlPodcastChannelPtr::dynamicCast( sqlEpisode->channel() ); - if( !sqlChannel ) + if( sqlChannel.isNull() ) { error() << "sqlChannelPtr is NULL after download"; cleanupDownload( job, true ); diff --git a/src/podcasts/sql/SqlPodcastProvider.h b/src/podcasts/sql/SqlPodcastProvider.h index 1b25c32..2bf7b0e 100644 --- a/src/podcasts/sql/SqlPodcastProvider.h +++ b/src/podcasts/sql/SqlPodcastProvider.h @@ -144,7 +144,7 @@ class SqlPodcastProvider : public PodcastProvider Meta::PodcastChannelList m_updateQueue; QList<KUrl> m_subscribeQueue; - QHash<KJob *, Meta::SqlPodcastEpisode *> m_downloadJobMap; + QHash<KJob *, Meta::SqlPodcastEpisodePtr> m_downloadJobMap; QHash<KJob *, QString> m_fileNameMap; QHash<KJob *, QFile*> m_tmpFileMap; *** Bug 233151 has been marked as a duplicate of this bug. *** *** Bug 235397 has been marked as a duplicate of this bug. *** *** Bug 238613 has been marked as a duplicate of this bug. *** *** Bug 240406 has been marked as a duplicate of this bug. *** *** Bug 242219 has been marked as a duplicate of this bug. *** *** Bug 245983 has been marked as a duplicate of this bug. *** *** Bug 248944 has been marked as a duplicate of this bug. *** *** Bug 251231 has been marked as a duplicate of this bug. *** *** Bug 252011 has been marked as a duplicate of this bug. *** *** Bug 268776 has been marked as a duplicate of this bug. *** |