Commit 396b5b13 authored by Joris Guisson's avatar Joris Guisson
Browse files

Fix crash caused by dangling pointer to TorrentControl when removing torrent...

Fix crash caused by dangling pointer to TorrentControl when removing torrent and torrent list is changing a lot

BUG: 208385

svn path=/branches/stable/extragear-kde4/network/ktorrent/; revision=1027754
parent c3ab5f1a
......@@ -4,6 +4,7 @@ Changes in 3.2.4 :
- Fix very rare crash caused by 0 pointer (206689)
- Fix bug causing scheduler to not restart the schedule timer
- Unset Qt message handler when Log is destroyed (197944)
- Fix crash caused by dangling pointer to TorrentControl when removing torrent and torrent list is changing a lot (208385)
Changes in 3.2.3 :
- Make sure View gets focus back when you are finished editing the name of a torrent
......
......@@ -73,7 +73,8 @@ namespace kt
status_tab = new StatusTab(0);
file_view = new FileView(0);
file_view->loadState(KGlobal::config());
connect(getCore(),SIGNAL(torrentRemoved(bt::TorrentInterface*)),file_view,SLOT(onTorrentRemoved(bt::TorrentInterface*)));
connect(getCore(),SIGNAL(torrentRemoved(bt::TorrentInterface*)),
this,SLOT(torrentRemoved(bt::TorrentInterface*)));
pref = new IWPrefPage(0);
getGUI()->addViewListener(this);
......@@ -92,7 +93,8 @@ namespace kt
{
LogSystemManager::instance().unregisterSystem(i18n("Bandwidth Scheduler"));
disconnect(getCore(),SIGNAL(settingsChanged()),this,SLOT(applySettings()));
disconnect(getCore(),SIGNAL(torrentRemoved(bt::TorrentInterface*)),file_view,SLOT(onTorrentRemoved(bt::TorrentInterface*)));
disconnect(getCore(),SIGNAL(torrentRemoved(bt::TorrentInterface*)),
this,SLOT(torrentRemoved(bt::TorrentInterface*)));
if (cd_view)
cd_view->saveState(KGlobal::config());
if (peer_view)
......@@ -304,6 +306,17 @@ namespace kt
if (tc && (peer_view || cd_view))
monitor = new Monitor(tc,peer_view,cd_view,file_view);
}
void InfoWidgetPlugin::torrentRemoved(bt::TorrentInterface* tc)
{
file_view->onTorrentRemoved(tc);
// for some reason currentTorrentChanged doesn't always get called
// when the current torrent is removed, this leads to crashes
// so manually call it here, to prevent crashes
currentTorrentChanged(getGUI()->getCurrentTorrent());
}
}
#include "infowidgetplugin.moc"
......@@ -70,6 +70,7 @@ namespace kt
private slots:
void applySettings();
void torrentRemoved(bt::TorrentInterface* tc);
private:
PeerView* peer_view;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment