]> granicus.if.org Git - transmission/commitdiff
(trunk qt) #4357 "Wrong torrent count on tracker filterbar" -- handle special case...
authorJordan Lee <jordan@transmissionbt.com>
Fri, 15 Jul 2011 02:17:33 +0000 (02:17 +0000)
committerJordan Lee <jordan@transmissionbt.com>
Fri, 15 Jul 2011 02:17:33 +0000 (02:17 +0000)
qt/filterbar.cc

index 05600140a7b654e1ea0eed65b407e1c5583162b2..2b0c002e01c5a6e02150d2d0694cdeed1d7f6d4a 100644 (file)
@@ -309,18 +309,18 @@ FilterBar :: refreshTrackers( )
             break;
         const Torrent * tor = index.data( TorrentModel::TorrentRole ).value<const Torrent*>();
         const QStringList trackers = tor->trackers( );
-        QSet<QString> torrentHosts;
+        QSet<QString> torrentNames;
         foreach( QString tracker, trackers ) {
             const QString host = Favicons::getHost( QUrl( tracker ) );
             if( host.isEmpty( ) )
                 qWarning() << "torrent" << qPrintable(tor->name()) << "has an invalid announce URL:" << tracker;
-            else
-                torrentHosts.insert( host );
-        }
-        foreach( QString host, torrentHosts ) {
-            newHosts.insert( host );
-            ++torrentsPerHost[ readableHostName( host ) ];
+            else {
+                newHosts.insert( host );
+                torrentNames.insert( readableHostName( host ) );
+            }
         }
+        foreach( QString name, torrentNames )
+            ++torrentsPerHost[ name ];
     }
 
     // update the "All" row