mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-24 02:06:07 +03:00
Fix crash on torrent completion
This commit is contained in:
parent
a6b1d308c2
commit
4b77bb57ad
4 changed files with 25 additions and 25 deletions
|
@ -1999,22 +1999,13 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
|
|||
if(appendqBExtension)
|
||||
appendqBextensionToTorrent(h, false);
|
||||
#endif
|
||||
// Move to download directory if necessary
|
||||
if(!defaultTempPath.isEmpty()) {
|
||||
// Check if directory is different
|
||||
const QDir current_dir(h.save_path());
|
||||
const QDir save_dir(getSavePath(hash));
|
||||
if(current_dir != save_dir) {
|
||||
h.move_storage(save_dir.path());
|
||||
}
|
||||
}
|
||||
const bool was_already_seeded = TorrentPersistentData::isSeed(hash);
|
||||
if(!was_already_seeded) {
|
||||
h.save_resume_data();
|
||||
qDebug("Checking if the torrent contains torrent files to download");
|
||||
// Check if there are torrent files inside
|
||||
torrent_info::file_iterator it;
|
||||
for(it = h.get_torrent_info().begin_files(); it != h.get_torrent_info().end_files(); it++) {
|
||||
for(torrent_info::file_iterator it = h.get_torrent_info().begin_files(); it != h.get_torrent_info().end_files(); it++) {
|
||||
qDebug("File path: %s", it->path.string().c_str());
|
||||
const QString torrent_relpath = misc::toQStringU(it->path.string()).replace("\\", "/");
|
||||
if(torrent_relpath.endsWith(".torrent", Qt::CaseInsensitive)) {
|
||||
qDebug("Found possible recursive torrent download.");
|
||||
|
@ -2034,6 +2025,15 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
|
|||
}
|
||||
}
|
||||
}
|
||||
// Move to download directory if necessary
|
||||
if(!defaultTempPath.isEmpty()) {
|
||||
// Check if directory is different
|
||||
const QDir current_dir(h.save_path());
|
||||
const QDir save_dir(getSavePath(hash));
|
||||
if(current_dir != save_dir) {
|
||||
h.move_storage(save_dir.absolutePath());
|
||||
}
|
||||
}
|
||||
// Recheck if the user asked to
|
||||
if(Preferences::recheckTorrentsOnCompletion() && !was_already_seeded) {
|
||||
// Remember finished state
|
||||
|
|
|
@ -50,12 +50,12 @@ QTorrentHandle::QTorrentHandle(torrent_handle h): h(h) {}
|
|||
// Getters
|
||||
//
|
||||
|
||||
torrent_handle QTorrentHandle::get_torrent_handle() const {
|
||||
const torrent_handle& QTorrentHandle::get_torrent_handle() const {
|
||||
Q_ASSERT(h.is_valid());
|
||||
return h;
|
||||
}
|
||||
|
||||
torrent_info QTorrentHandle::get_torrent_info() const {
|
||||
const torrent_info& QTorrentHandle::get_torrent_info() const {
|
||||
Q_ASSERT(h.is_valid());
|
||||
return h.get_torrent_info();
|
||||
}
|
||||
|
@ -302,7 +302,7 @@ size_type QTorrentHandle::filesize_at(unsigned int index) const {
|
|||
return h.get_torrent_info().file_at(index).size;
|
||||
}
|
||||
|
||||
std::vector<announce_entry> QTorrentHandle::trackers() const {
|
||||
const std::vector<announce_entry>& QTorrentHandle::trackers() const {
|
||||
Q_ASSERT(h.is_valid());
|
||||
return h.trackers();
|
||||
}
|
||||
|
@ -531,7 +531,7 @@ void QTorrentHandle::set_max_connections(int val) {
|
|||
h.set_max_connections(val);
|
||||
}
|
||||
|
||||
void QTorrentHandle::prioritize_files(std::vector<int> v) {
|
||||
void QTorrentHandle::prioritize_files(const std::vector<int> &v) {
|
||||
// Does not do anything for seeding torrents
|
||||
Q_ASSERT(h.is_valid());
|
||||
if(v.size() != (unsigned int)h.get_torrent_info().num_files())
|
||||
|
@ -546,7 +546,7 @@ void QTorrentHandle::set_ratio(float ratio) const {
|
|||
h.set_ratio(ratio);
|
||||
}
|
||||
|
||||
void QTorrentHandle::replace_trackers(std::vector<announce_entry> const& v) const {
|
||||
void QTorrentHandle::replace_trackers(const std::vector<announce_entry> & v) const {
|
||||
Q_ASSERT(h.is_valid());
|
||||
h.replace_trackers(v);
|
||||
}
|
||||
|
@ -653,7 +653,7 @@ void QTorrentHandle::set_peer_download_limit(libtorrent::asio::ip::tcp::endpoint
|
|||
h.set_peer_download_limit(ip, limit);
|
||||
}
|
||||
|
||||
void QTorrentHandle::add_tracker(announce_entry const& url) {
|
||||
void QTorrentHandle::add_tracker(const announce_entry& url) {
|
||||
Q_ASSERT(h.is_valid());
|
||||
#if LIBTORRENT_VERSION_MINOR > 14
|
||||
h.add_tracker(url);
|
||||
|
|
|
@ -60,8 +60,8 @@ class QTorrentHandle {
|
|||
// Getters
|
||||
//
|
||||
|
||||
torrent_handle get_torrent_handle() const;
|
||||
torrent_info get_torrent_info() const;
|
||||
const torrent_handle& get_torrent_handle() const;
|
||||
const torrent_info& get_torrent_info() const;
|
||||
QString hash() const;
|
||||
QString name() const;
|
||||
float progress() const;
|
||||
|
@ -97,7 +97,7 @@ class QTorrentHandle {
|
|||
bool is_queued() const;
|
||||
QString file_at(unsigned int index) const;
|
||||
size_type filesize_at(unsigned int index) const;
|
||||
std::vector<announce_entry> trackers() const;
|
||||
const std::vector<announce_entry>& trackers() const;
|
||||
torrent_status::state_t state() const;
|
||||
QString creator() const;
|
||||
QString comment() const;
|
||||
|
@ -148,10 +148,10 @@ class QTorrentHandle {
|
|||
void add_url_seed(QString seed);
|
||||
void set_max_uploads(int val);
|
||||
void set_max_connections(int val);
|
||||
void prioritize_files(std::vector<int> v);
|
||||
void prioritize_files(const std::vector<int> &v);
|
||||
void file_priority(int index, int priority) const;
|
||||
void set_ratio(float ratio) const;
|
||||
void replace_trackers(std::vector<announce_entry> const&) const;
|
||||
void replace_trackers(const std::vector<announce_entry>& trackers) const;
|
||||
void force_reannounce();
|
||||
void set_sequential_download(bool);
|
||||
void set_tracker_login(QString username, QString password);
|
||||
|
@ -170,7 +170,7 @@ class QTorrentHandle {
|
|||
void connect_peer(libtorrent::asio::ip::tcp::endpoint const& adr, int source = 0) const;
|
||||
void set_peer_upload_limit(libtorrent::asio::ip::tcp::endpoint ip, int limit) const;
|
||||
void set_peer_download_limit(libtorrent::asio::ip::tcp::endpoint ip, int limit) const;
|
||||
void add_tracker(announce_entry const& url);
|
||||
void add_tracker(const announce_entry& url);
|
||||
void prioritize_first_last_piece(bool b);
|
||||
void rename_file(int index, QString name);
|
||||
bool save_torrent_file(QString path);
|
||||
|
|
|
@ -12,9 +12,9 @@ CONFIG += qt \
|
|||
|
||||
# Update this VERSION for each release
|
||||
os2 {
|
||||
DEFINES += VERSION=\'\"v2.3.0rc8\"\'
|
||||
DEFINES += VERSION=\'\"v2.3.0rc9\"\'
|
||||
} else {
|
||||
DEFINES += VERSION=\\\"v2.3.0rc8\\\"
|
||||
DEFINES += VERSION=\\\"v2.3.0rc9\\\"
|
||||
}
|
||||
DEFINES += VERSION_MAJOR=2
|
||||
DEFINES += VERSION_MINOR=3
|
||||
|
|
Loading…
Reference in a new issue