Browse Source

Fix possible crash when using the new "Auto-shutdown" feature

adaptive-webui-19844
Christophe Dumez 14 years ago
parent
commit
e323175275
  1. 4
      src/GUI.cpp
  2. 8
      src/bittorrent.cpp
  3. 2
      src/main.cpp

4
src/GUI.cpp

@ -286,10 +286,8 @@ GUI::~GUI() {
delete switchTransferShortcut; delete switchTransferShortcut;
delete switchRSSShortcut; delete switchRSSShortcut;
// Delete BTSession objects // Delete BTSession objects
qDebug("Deleting BTSession");
delete BTSession; delete BTSession;
// Deleting remaining top level widgets
qDebug("Deleting remaining top level widgets");
// May freeze for a few seconds after the next line // May freeze for a few seconds after the next line
// because the Bittorrent session proxy will // because the Bittorrent session proxy will
// actually be deleted now and destruction // actually be deleted now and destruction

8
src/bittorrent.cpp

@ -2049,12 +2049,16 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
#if LIBTORRENT_VERSION_MINOR < 15 #if LIBTORRENT_VERSION_MINOR < 15
saveDHTEntry(); saveDHTEntry();
#endif #endif
qDebug("Saving session state");
saveSessionState(); saveSessionState();
qDebug("Saving fast resume data");
saveFastResumeData(); saveFastResumeData();
qDebug("Deleting the session");
delete s; delete s;
qDebug("Sending computer shutdown signal");
misc::shutdownComputer(); misc::shutdownComputer();
exiting = true; qDebug("Exiting the application");
qApp->exit(); exit(0);
} }
} }
} }

2
src/main.cpp

@ -308,7 +308,7 @@ int main(int argc, char *argv[]){
#endif #endif
int ret = app.exec(); int ret = app.exec();
qDebug("Application has exited");
return ret; return ret;
} }

Loading…
Cancel
Save