From 201aaae897d04c9f75248f6b3011ece9627db748 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Thu, 13 Jan 2011 20:44:42 +0000 Subject: [PATCH] Fix possible crashes in full allocation mode --- Changelog | 3 +++ src/qtlibtorrent/qbtsession.cpp | 6 ++++-- src/qtlibtorrent/qbtsession.h | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Changelog b/Changelog index 979281361..578901f43 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,6 @@ +* Unreleased - Christophe Dumez - v2.6.3 + - BUGFIX: Fix possible crashes in full allocation mode + * Wed Jan 12 2011 - Christophe Dumez - v2.6.2 - BUGFIX: Do not report PeX as being disabled when DHT is - BUGFIX: Fix possible crash on adding magnet links diff --git a/src/qtlibtorrent/qbtsession.cpp b/src/qtlibtorrent/qbtsession.cpp index 6ff9ad0fc..e963bd8cd 100644 --- a/src/qtlibtorrent/qbtsession.cpp +++ b/src/qtlibtorrent/qbtsession.cpp @@ -2583,7 +2583,7 @@ void QBtSession::handleIPFilterError() emit ipFilterParsed(true, 0); } -entry QBtSession::generateFilePriorityResumeData(boost::intrusive_ptr t, const std::vector &fp) +entry QBtSession::generateFilePriorityResumeData(boost::intrusive_ptr &t, const std::vector &fp) { entry::dictionary_type rd; rd["file-format"] = "libtorrent resume file"; @@ -2601,6 +2601,7 @@ entry QBtSession::generateFilePriorityResumeData(boost::intrusive_ptrnum_files()); for(int i=0; inum_files(); ++i) { entry::list_type p; p.push_back(entry(0)); @@ -2617,7 +2618,8 @@ entry QBtSession::generateFilePriorityResumeData(boost::intrusive_ptrnum_pieces()); + pieces.resize(t->num_pieces()); + std::memset(&pieces[0], 0, pieces.size()); rd["pieces"] = entry(pieces); entry ret(rd); diff --git a/src/qtlibtorrent/qbtsession.h b/src/qtlibtorrent/qbtsession.h index 2dc723fb2..d8b8efc97 100644 --- a/src/qtlibtorrent/qbtsession.h +++ b/src/qtlibtorrent/qbtsession.h @@ -167,7 +167,7 @@ private: void loadTorrentSettings(QTorrentHandle h); void loadTorrentTempData(QTorrentHandle h, QString savePath, bool magnet); libtorrent::add_torrent_params initializeAddTorrentParams(QString hash); - libtorrent::entry generateFilePriorityResumeData(boost::intrusive_ptr t, const std::vector &fp); + libtorrent::entry generateFilePriorityResumeData(boost::intrusive_ptr &t, const std::vector &fp); private slots: void addTorrentsFromScanFolder(QStringList&);