Gentoo Archives: gentoo-commits

From: "Jorge Manuel B. S. Vicetto (jmbsvicetto)" <jmbsvicetto@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in media-sound/amarok/files: amarok-2.2.2-nodebug.patch
Date: Fri, 08 Jan 2010 15:53:31
Message-Id: E1NTH9U-0006uL-7W@stork.gentoo.org
1 jmbsvicetto 10/01/08 15:53:28
2
3 Added: amarok-2.2.2-nodebug.patch
4 Log:
5 Bumped amarok to 2.2.2 (should be out next Monday).
6 Dropped semantic-desktop from IUSE defaults and added Jeff Mitchell patch to fix some scanning issues.
7 (Portage version: 2.2_rc61/cvs/Linux x86_64)
8
9 Revision Changes Path
10 1.1 media-sound/amarok/files/amarok-2.2.2-nodebug.patch
11
12 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/media-sound/amarok/files/amarok-2.2.2-nodebug.patch?rev=1.1&view=markup
13 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/media-sound/amarok/files/amarok-2.2.2-nodebug.patch?rev=1.1&content-type=text/plain
14
15 Index: amarok-2.2.2-nodebug.patch
16 ===================================================================
17 Jeff Mitchell <mitchell@×××.org>
18 Fixes a crash that can occur during scanning. This patch should be applied to 2.2.2 vanilla.
19
20
21 diff --git a/src/collection/sqlcollection/ScanResultProcessor.cpp b/src/collection/sqlcollection/ScanResultProcessor.cpp
22 index b680623..889eccb 100644
23 --- a/src/collection/sqlcollection/ScanResultProcessor.cpp
24 +++ b/src/collection/sqlcollection/ScanResultProcessor.cpp
25 @@ -43,18 +43,33 @@ ScanResultProcessor::~ScanResultProcessor()
26 {
27 //everything has a URL, so enough to just delete from here
28 foreach( QStringList *list, m_urlsHashByUid )
29 - delete list;
30 + {
31 + if( list )
32 + delete list;
33 + }
34 foreach( QLinkedList<QStringList*> *list, m_albumsHashByName )
35 {
36 - foreach( QStringList *slist, *list )
37 - delete slist;
38 - delete list;
39 + if( list )
40 + {
41 + foreach( QStringList *slist, *list )
42 + {
43 + if( slist )
44 + delete slist;
45 + }
46 + delete list;
47 + }
48 }
49 foreach( QLinkedList<QStringList*> *list, m_tracksHashByAlbum )
50 {
51 - foreach( QStringList *slist, *list )
52 - delete slist;
53 - delete list;
54 + if( list )
55 + {
56 + foreach( QStringList *slist, *list )
57 + {
58 + if( slist )
59 + delete slist;
60 + }
61 + delete list;
62 + }
63 }
64 }
65
66 @@ -68,10 +83,10 @@ void
67 ScanResultProcessor::addDirectory( const QString &dir, uint mtime )
68 {
69 DEBUG_BLOCK
70 - debug() << "SRP::addDirectory on " << dir << " with mtime " << mtime;
71 + //debug() << "SRP::addDirectory on " << dir << " with mtime " << mtime;
72 if( dir.isEmpty() )
73 {
74 - debug() << "got directory with no path from the scanner, not adding";
75 + //debug() << "got directory with no path from the scanner, not adding";
76 return;
77 }
78 setupDatabase();
79 @@ -419,7 +434,15 @@ ScanResultProcessor::addTrack( const QVariantMap &trackData, int albumArtistId )
80
81 //urlId will take care of the urls table part of AFT
82 int url = urlId( path, uid );
83 -
84 +/*
85 + foreach( QString key, m_urlsHashByUid.keys() )
86 + debug() << "Key: " << key << ", list: " << *m_urlsHashByUid[key];
87 + foreach( int key, m_urlsHashById.keys() )
88 + debug() << "Key: " << key << ", list: " << *m_urlsHashById[key];
89 + typedef QPair<int, QString> blahType; //QFOREACH is stupid when it comes to QPairs
90 + foreach( blahType key, m_urlsHashByLocation.keys() )
91 + debug() << "Key: " << key << ", list: " << *m_urlsHashByLocation[key];
92 +*/
93 QStringList *trackList = new QStringList();
94 int id = m_nextTrackNum;
95 //debug() << "Appending new track number with tracknum: " << id;
96 @@ -470,7 +493,7 @@ ScanResultProcessor::addTrack( const QVariantMap &trackData, int albumArtistId )
97 //insert into hashes
98 if( m_tracksHashByUrl.contains( url ) && m_tracksHashByUrl[url] != 0 )
99 {
100 - //debug() << "m_tracksHashByUrl contains the url!";
101 + //debug() << "m_tracksHashByUrl already contains url " << url;
102 //need to replace, not overwrite/add a new one
103 QStringList *oldValues = m_tracksHashByUrl[url];
104 QString oldId = oldValues->at( 0 );
105 @@ -491,7 +514,12 @@ ScanResultProcessor::addTrack( const QVariantMap &trackData, int albumArtistId )
106 }
107
108 if( m_tracksHashByAlbum.contains( album ) && m_tracksHashByAlbum[album] != 0 )
109 - m_tracksHashByAlbum[album]->append( trackList );
110 + {
111 + //contains isn't the fastest on linked lists, but in reality this is on the order of maybe
112 + //ten quick pointer comparisons per track on average...probably lower
113 + if( !m_tracksHashByAlbum[album]->contains( trackList ) )
114 + m_tracksHashByAlbum[album]->append( trackList );
115 + }
116 else
117 {
118 QLinkedList<QStringList*> *list = new QLinkedList<QStringList*>();
119 @@ -631,7 +659,10 @@ ScanResultProcessor::albumInsert( const QString &album, int albumArtistId )
120 albumList->append( QString() );
121 m_albumsHashById[returnedNum] = albumList;
122 if( m_albumsHashByName.contains( album ) && m_albumsHashByName[album] != 0 )
123 - m_albumsHashByName[album]->append( albumList );
124 + {
125 + if( !m_albumsHashByName[album]->contains( albumList ) )
126 + m_albumsHashByName[album]->append( albumList );
127 + }
128 else
129 {
130 QLinkedList<QStringList*> *list = new QLinkedList<QStringList*>();
131 @@ -645,7 +676,7 @@ ScanResultProcessor::albumInsert( const QString &album, int albumArtistId )
132 int
133 ScanResultProcessor::urlId( const QString &url, const QString &uid )
134 {
135 - /*
136 +/*
137 DEBUG_BLOCK
138 foreach( QString key, m_urlsHashByUid.keys() )
139 debug() << "Key: " << key << ", list: " << *m_urlsHashByUid[key];
140 @@ -654,8 +685,8 @@ ScanResultProcessor::urlId( const QString &url, const QString &uid )
141 typedef QPair<int, QString> blahType; //QFOREACH is stupid when it comes to QPairs
142 foreach( blahType key, m_urlsHashByLocation.keys() )
143 debug() << "Key: " << key << ", list: " << *m_urlsHashByLocation[key];
144 - */
145 -
146 +*/
147 +
148 QFileInfo fileInfo( url );
149 const QString dir = fileInfo.absoluteDir().absolutePath();
150 int dirId = directoryId( dir );
151 @@ -665,6 +696,7 @@ ScanResultProcessor::urlId( const QString &url, const QString &uid )
152 QPair<int, QString> locationPair( deviceId, rpath );
153 //debug() << "in urlId with url = " << url << " and uid = " << uid;
154 //debug() << "checking locationPair " << locationPair;
155 +/*
156 if( m_urlsHashByLocation.contains( locationPair ) )
157 {
158 QStringList values;
159 @@ -674,6 +706,7 @@ ScanResultProcessor::urlId( const QString &url, const QString &uid )
160 values << "zero";
161 //debug() << "m_urlsHashByLocation contains it! It is " << values;
162 }
163 +*/
164 QStringList currUrlIdValues;
165 if( m_urlsHashByUid.contains( uid ) && m_urlsHashByUid[uid] != 0 )
166 currUrlIdValues = *m_urlsHashByUid[uid];
167 @@ -717,6 +750,7 @@ ScanResultProcessor::urlId( const QString &url, const QString &uid )
168 //debug() << "m_urlsHashByUid contains this UID, updating deviceId and path";
169 QStringList *list = m_urlsHashByUid[uid];
170 //debug() << "list from UID hash is " << list << " with values " << *list;
171 + QPair<int, QString> oldLocationPair( list->at( 1 ).toInt(), list->at( 2 ) );
172 list->replace( 1, QString::number( deviceId ) );
173 list->replace( 2, rpath );
174 list->replace( 3, QString::number( dirId ) );
175 @@ -737,6 +771,7 @@ ScanResultProcessor::urlId( const QString &url, const QString &uid )
176 delete oldList;
177 }
178 m_urlsHashByLocation[locationPair] = list;
179 + m_urlsHashByLocation.remove( oldLocationPair );
180 }
181 m_permanentTablesUrlUpdates.insert( uid, url );
182 m_changedUrls.insert( uid, QPair<QString, QString>( MountPointManager::instance()->getAbsolutePath( currUrlIdValues[1].toInt(), currUrlIdValues[2] ), url ) );
183 @@ -751,6 +786,7 @@ ScanResultProcessor::urlId( const QString &url, const QString &uid )
184 {
185 QStringList *list = m_urlsHashByLocation[locationPair];
186 //debug() << "Replacing hash " << list->at( 4 ) << " with " << uid;
187 + QString oldId = list->at( 4 );
188 list->replace( 4, uid );
189 if( m_urlsHashByUid.contains( uid )
190 && m_urlsHashByUid[uid] != 0
191 @@ -762,6 +798,7 @@ ScanResultProcessor::urlId( const QString &url, const QString &uid )
192 delete oldList;
193 }
194 m_urlsHashByUid[uid] = list;
195 + m_urlsHashByUid.remove( oldId );
196 }
197 m_permanentTablesUidUpdates.insert( url, uid );
198 m_changedUids.insert( currUrlIdValues[4], uid );
199 @@ -1167,6 +1204,18 @@ ScanResultProcessor::copyHashesToTempTables()
200 foreach( blahType key, m_urlsHashByLocation.keys() )
201 debug() << "Key: " << key << ", list: " << *m_urlsHashByLocation[key];
202 debug() << "Next album num: " << m_nextAlbumNum;
203 +
204 + foreach( int key, m_tracksHashById.keys() )
205 + debug() << "Key: " << key << ", list: " << *m_tracksHashById[key];
206 + foreach( int key, m_tracksHashByUrl.keys() )
207 + debug() << "Key: " << key << ", list: " << *m_tracksHashByUrl[key];
208 + typedef QLinkedList<QStringList*> blahType; //QFOREACH is stupid when it comes to QPairs
209 + foreach( int key, m_tracksHashByAlbum.keys() )
210 + {
211 + debug() << "Key: " << key;
212 + foreach( QStringList* item, *m_tracksHashByAlbum[key] )
213 + debug() << "list: " << *item;
214 + }
215 */
216
217 DEBUG_BLOCK