Browse Source

Fix crash when accessing trackers and using libtorrent v0.15.x

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
902196a176
  1. 2
      src/qtorrenthandle.cpp
  2. 2
      src/qtorrenthandle.h
  3. 2
      src/trackerlist.cpp

2
src/qtorrenthandle.cpp

@ -302,7 +302,7 @@ size_type QTorrentHandle::filesize_at(unsigned int index) const {
return h.get_torrent_info().file_at(index).size; return h.get_torrent_info().file_at(index).size;
} }
const std::vector<announce_entry>& QTorrentHandle::trackers() const { const std::vector<announce_entry> QTorrentHandle::trackers() const {
Q_ASSERT(h.is_valid()); Q_ASSERT(h.is_valid());
return h.trackers(); return h.trackers();
} }

2
src/qtorrenthandle.h

@ -97,7 +97,7 @@ class QTorrentHandle {
bool is_queued() const; bool is_queued() const;
QString file_at(unsigned int index) const; QString file_at(unsigned int index) const;
size_type filesize_at(unsigned int index) const; size_type filesize_at(unsigned int index) const;
const std::vector<announce_entry>& trackers() const; const std::vector<announce_entry> trackers() const;
torrent_status::state_t state() const; torrent_status::state_t state() const;
QString creator() const; QString creator() const;
QString comment() const; QString comment() const;

2
src/trackerlist.cpp

@ -231,7 +231,7 @@ void TrackerList::loadTrackers() {
// Load actual trackers information // Load actual trackers information
QHash<QString, TrackerInfos> trackers_data = properties->getBTSession()->getTrackersInfo(h.hash()); QHash<QString, TrackerInfos> trackers_data = properties->getBTSession()->getTrackersInfo(h.hash());
QStringList old_trackers_urls = tracker_items.keys(); QStringList old_trackers_urls = tracker_items.keys();
const std::vector<announce_entry> &trackers = h.trackers(); const std::vector<announce_entry> trackers = h.trackers();
for(std::vector<announce_entry>::const_iterator it = trackers.begin(); it != trackers.end(); it++) { for(std::vector<announce_entry>::const_iterator it = trackers.begin(); it != trackers.end(); it++) {
QString tracker_url = misc::toQString(it->url); QString tracker_url = misc::toQString(it->url);
QTreeWidgetItem *item = tracker_items.value(tracker_url, 0); QTreeWidgetItem *item = tracker_items.value(tracker_url, 0);

Loading…
Cancel
Save