From 802a36677a225198334e290350f5c5d7f1c4756f Mon Sep 17 00:00:00 2001 From: Rex Dieter Date: Jan 08 2010 19:08:34 +0000 Subject: - amarok-2.2.2 --- diff --git a/amarok-2.2.2-kde#220532.patch b/amarok-2.2.2-kde#220532.patch new file mode 100644 index 0000000..31ccb53 --- /dev/null +++ b/amarok-2.2.2-kde#220532.patch @@ -0,0 +1,202 @@ +Jeff Mitchell +Fixes a crash that can occur during scanning. This patch should be applied to 2.2.2 vanilla. + + +diff --git a/src/collection/sqlcollection/ScanResultProcessor.cpp b/src/collection/sqlcollection/ScanResultProcessor.cpp +index b680623..a8806b3 100644 +--- a/src/collection/sqlcollection/ScanResultProcessor.cpp ++++ b/src/collection/sqlcollection/ScanResultProcessor.cpp +@@ -43,18 +43,33 @@ ScanResultProcessor::~ScanResultProcessor() + { + //everything has a URL, so enough to just delete from here + foreach( QStringList *list, m_urlsHashByUid ) +- delete list; ++ { ++ if( list ) ++ delete list; ++ } + foreach( QLinkedList *list, m_albumsHashByName ) + { +- foreach( QStringList *slist, *list ) +- delete slist; +- delete list; ++ if( list ) ++ { ++ foreach( QStringList *slist, *list ) ++ { ++ if( slist ) ++ delete slist; ++ } ++ delete list; ++ } + } + foreach( QLinkedList *list, m_tracksHashByAlbum ) + { +- foreach( QStringList *slist, *list ) +- delete slist; +- delete list; ++ if( list ) ++ { ++ foreach( QStringList *slist, *list ) ++ { ++ if( slist ) ++ delete slist; ++ } ++ delete list; ++ } + } + } + +@@ -68,10 +83,10 @@ void + ScanResultProcessor::addDirectory( const QString &dir, uint mtime ) + { + DEBUG_BLOCK +- debug() << "SRP::addDirectory on " << dir << " with mtime " << mtime; ++ //debug() << "SRP::addDirectory on " << dir << " with mtime " << mtime; + if( dir.isEmpty() ) + { +- debug() << "got directory with no path from the scanner, not adding"; ++ //debug() << "got directory with no path from the scanner, not adding"; + return; + } + setupDatabase(); +@@ -419,7 +434,15 @@ ScanResultProcessor::addTrack( const QVariantMap &trackData, int albumArtistId ) + + //urlId will take care of the urls table part of AFT + int url = urlId( path, uid ); +- ++/* ++ foreach( QString key, m_urlsHashByUid.keys() ) ++ debug() << "Key: " << key << ", list: " << *m_urlsHashByUid[key]; ++ foreach( int key, m_urlsHashById.keys() ) ++ debug() << "Key: " << key << ", list: " << *m_urlsHashById[key]; ++ typedef QPair blahType; //QFOREACH is stupid when it comes to QPairs ++ foreach( blahType key, m_urlsHashByLocation.keys() ) ++ debug() << "Key: " << key << ", list: " << *m_urlsHashByLocation[key]; ++*/ + QStringList *trackList = new QStringList(); + int id = m_nextTrackNum; + //debug() << "Appending new track number with tracknum: " << id; +@@ -470,7 +493,7 @@ ScanResultProcessor::addTrack( const QVariantMap &trackData, int albumArtistId ) + //insert into hashes + if( m_tracksHashByUrl.contains( url ) && m_tracksHashByUrl[url] != 0 ) + { +- //debug() << "m_tracksHashByUrl contains the url!"; ++ //debug() << "m_tracksHashByUrl already contains url " << url; + //need to replace, not overwrite/add a new one + QStringList *oldValues = m_tracksHashByUrl[url]; + QString oldId = oldValues->at( 0 ); +@@ -491,7 +514,12 @@ ScanResultProcessor::addTrack( const QVariantMap &trackData, int albumArtistId ) + } + + if( m_tracksHashByAlbum.contains( album ) && m_tracksHashByAlbum[album] != 0 ) +- m_tracksHashByAlbum[album]->append( trackList ); ++ { ++ //contains isn't the fastest on linked lists, but in reality this is on the order of maybe ++ //ten quick pointer comparisons per track on average...probably lower ++ if( !m_tracksHashByAlbum[album]->contains( trackList ) ) ++ m_tracksHashByAlbum[album]->append( trackList ); ++ } + else + { + QLinkedList *list = new QLinkedList(); +@@ -631,7 +659,10 @@ ScanResultProcessor::albumInsert( const QString &album, int albumArtistId ) + albumList->append( QString() ); + m_albumsHashById[returnedNum] = albumList; + if( m_albumsHashByName.contains( album ) && m_albumsHashByName[album] != 0 ) +- m_albumsHashByName[album]->append( albumList ); ++ { ++ if( !m_albumsHashByName[album]->contains( albumList ) ) ++ m_albumsHashByName[album]->append( albumList ); ++ } + else + { + QLinkedList *list = new QLinkedList(); +@@ -645,8 +676,8 @@ ScanResultProcessor::albumInsert( const QString &album, int albumArtistId ) + int + ScanResultProcessor::urlId( const QString &url, const QString &uid ) + { +- /* + DEBUG_BLOCK ++/* + foreach( QString key, m_urlsHashByUid.keys() ) + debug() << "Key: " << key << ", list: " << *m_urlsHashByUid[key]; + foreach( int key, m_urlsHashById.keys() ) +@@ -654,8 +685,8 @@ ScanResultProcessor::urlId( const QString &url, const QString &uid ) + typedef QPair blahType; //QFOREACH is stupid when it comes to QPairs + foreach( blahType key, m_urlsHashByLocation.keys() ) + debug() << "Key: " << key << ", list: " << *m_urlsHashByLocation[key]; +- */ +- ++*/ ++ + QFileInfo fileInfo( url ); + const QString dir = fileInfo.absoluteDir().absolutePath(); + int dirId = directoryId( dir ); +@@ -665,6 +696,7 @@ ScanResultProcessor::urlId( const QString &url, const QString &uid ) + QPair locationPair( deviceId, rpath ); + //debug() << "in urlId with url = " << url << " and uid = " << uid; + //debug() << "checking locationPair " << locationPair; ++/* + if( m_urlsHashByLocation.contains( locationPair ) ) + { + QStringList values; +@@ -674,6 +706,7 @@ ScanResultProcessor::urlId( const QString &url, const QString &uid ) + values << "zero"; + //debug() << "m_urlsHashByLocation contains it! It is " << values; + } ++*/ + QStringList currUrlIdValues; + if( m_urlsHashByUid.contains( uid ) && m_urlsHashByUid[uid] != 0 ) + currUrlIdValues = *m_urlsHashByUid[uid]; +@@ -717,6 +750,7 @@ ScanResultProcessor::urlId( const QString &url, const QString &uid ) + //debug() << "m_urlsHashByUid contains this UID, updating deviceId and path"; + QStringList *list = m_urlsHashByUid[uid]; + //debug() << "list from UID hash is " << list << " with values " << *list; ++ QPair oldLocationPair( list->at( 1 ).toInt(), list->at( 2 ) ); + list->replace( 1, QString::number( deviceId ) ); + list->replace( 2, rpath ); + list->replace( 3, QString::number( dirId ) ); +@@ -737,6 +771,7 @@ ScanResultProcessor::urlId( const QString &url, const QString &uid ) + delete oldList; + } + m_urlsHashByLocation[locationPair] = list; ++ m_urlsHashByLocation.remove( oldLocationPair ); + } + m_permanentTablesUrlUpdates.insert( uid, url ); + m_changedUrls.insert( uid, QPair( MountPointManager::instance()->getAbsolutePath( currUrlIdValues[1].toInt(), currUrlIdValues[2] ), url ) ); +@@ -751,6 +786,7 @@ ScanResultProcessor::urlId( const QString &url, const QString &uid ) + { + QStringList *list = m_urlsHashByLocation[locationPair]; + //debug() << "Replacing hash " << list->at( 4 ) << " with " << uid; ++ QString oldId = list->at( 4 ); + list->replace( 4, uid ); + if( m_urlsHashByUid.contains( uid ) + && m_urlsHashByUid[uid] != 0 +@@ -762,6 +798,7 @@ ScanResultProcessor::urlId( const QString &url, const QString &uid ) + delete oldList; + } + m_urlsHashByUid[uid] = list; ++ m_urlsHashByUid.remove( oldId ); + } + m_permanentTablesUidUpdates.insert( url, uid ); + m_changedUids.insert( currUrlIdValues[4], uid ); +@@ -1167,6 +1204,18 @@ ScanResultProcessor::copyHashesToTempTables() + foreach( blahType key, m_urlsHashByLocation.keys() ) + debug() << "Key: " << key << ", list: " << *m_urlsHashByLocation[key]; + debug() << "Next album num: " << m_nextAlbumNum; ++ ++ foreach( int key, m_tracksHashById.keys() ) ++ debug() << "Key: " << key << ", list: " << *m_tracksHashById[key]; ++ foreach( int key, m_tracksHashByUrl.keys() ) ++ debug() << "Key: " << key << ", list: " << *m_tracksHashByUrl[key]; ++ typedef QLinkedList blahType; //QFOREACH is stupid when it comes to QPairs ++ foreach( int key, m_tracksHashByAlbum.keys() ) ++ { ++ debug() << "Key: " << key; ++ foreach( QStringList* item, *m_tracksHashByAlbum[key] ) ++ debug() << "list: " << *item; ++ } + */ + + DEBUG_BLOCK diff --git a/amarok.spec b/amarok.spec index 0a97e4b..38a466d 100644 --- a/amarok.spec +++ b/amarok.spec @@ -2,7 +2,7 @@ Name: amarok Summary: Media player Version: 2.2.2 -Release: 1%{?dist} +Release: 2%{?dist} Group: Applications/Multimedia License: GPLv2+ @@ -15,6 +15,8 @@ Patch1: amarok-2.2.2-no_var_tracking.patch Patch50: amarok-2.2.1.90-qtscript_not_required.patch ## upstream patches +# http://bugs.kde.org/220532 +Patch100: amarok-2.2.2-kde#220532.patch BuildRequires: curl-devel BuildRequires: desktop-file-utils @@ -87,6 +89,7 @@ Obsoletes: amarok-utilities < 2.0.96 %patch1 -p1 -b .no_var_tracking %endif %patch50 -p1 -b .qtscript_not_required +%patch100 -p1 -b .kde#220532 %build