Browse Source

Cleaned up QBtSession destructor code

adaptive-webui-19844
Christophe Dumez 14 years ago
parent
commit
efe5e7b068
  1. 27
      src/qtlibtorrent/qbtsession.cpp
  2. 3
      src/qtlibtorrent/qbtsession.h

27
src/qtlibtorrent/qbtsession.cpp

@ -81,7 +81,7 @@ QBtSession::QBtSession() @@ -81,7 +81,7 @@ QBtSession::QBtSession()
preAllocateAll(false), addInPause(false), ratio_limit(-1),
UPnPEnabled(false), NATPMPEnabled(false), LSDEnabled(false),
DHTEnabled(false), current_dht_port(0), queueingEnabled(false),
torrentExport(false), exiting(false)
torrentExport(false)
#ifndef DISABLE_GUI
, geoipDBLoaded(false), resolve_countries(false)
#endif
@ -143,37 +143,15 @@ QBtSession::QBtSession() @@ -143,37 +143,15 @@ QBtSession::QBtSession()
qDebug("* BTSession constructed");
}
session_proxy QBtSession::asyncDeletion() {
qDebug("Bittorrent session async deletion IN");
exiting = true;
// Do some BT related saving
#if LIBTORRENT_VERSION_MINOR < 15
saveDHTEntry();
#endif
saveSessionState();
saveFastResumeData();
// Delete session
session_proxy sp = s->abort();
delete s;
qDebug("Bittorrent session async deletion OUT");
return sp;
}
// Main destructor
QBtSession::~QBtSession() {
qDebug("BTSession destructor IN");
if(!exiting) {
// Do some BT related saving
#if LIBTORRENT_VERSION_MINOR < 15
saveDHTEntry();
#endif
saveSessionState();
saveFastResumeData();
qDebug("Deleting the session");
// Delete session
session_proxy sp = s->abort();
delete s;
}
// Delete our objects
if(m_tracker)
delete m_tracker;
@ -190,6 +168,9 @@ QBtSession::~QBtSession() { @@ -190,6 +168,9 @@ QBtSession::~QBtSession() {
delete httpServer;
if(timerETA)
delete timerETA;
// Delete session
qDebug("Deleting the session");
delete s;
qDebug("BTSession destructor OUT");
}

3
src/qtlibtorrent/qbtsession.h

@ -108,7 +108,6 @@ public slots: @@ -108,7 +108,6 @@ public slots:
void downloadFromUrl(QString url);
void deleteTorrent(QString hash, bool delete_local_files = false);
void startUpTorrents();
session_proxy asyncDeletion();
void recheckTorrent(QString hash);
void useAlternativeSpeedsLimit(bool alternative);
/* Needed by Web UI */
@ -257,8 +256,6 @@ private: @@ -257,8 +256,6 @@ private:
// Web UI
QPointer<HttpServer> httpServer;
QList<QUrl> url_skippingDlg;
// Fast exit (async)
bool exiting;
// GeoIP
#ifndef DISABLE_GUI
bool geoipDBLoaded;

Loading…
Cancel
Save