Bug 134054

Summary: InfoWidget kills Ktorrent when using dht(?)-torrent
Product: [Applications] ktorrent Reporter: Clara Gnos <clara.gnos>
Component: generalAssignee: Joris Guisson <joris.guisson>
Status: RESOLVED FIXED    
Severity: crash    
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: SVGView.exe.torrent

Description Clara Gnos 2006-09-14 10:39:19 UTC
Version:           SVN 583985 (using KDE KDE 3.5.4)
Installed from:    Gentoo Packages
Compiler:          gcc (GCC) 4.1.1 (Gentoo 4.1.1-r1) 
OS:                Linux

When I open that torrent, the info widget is loaded and then clicking on it, ktorrent will crash. I cannot create backtraces at the moment. So I only found out, that it doesnt happen when I unload InfoWidget
Comment 1 Clara Gnos 2006-09-14 10:40:14 UTC
Program received signal SIGSEGV, Segmentation fault. 
[Switching to Thread -1233578320 (LWP 8412)] 
0xb7e19152 in bt::Tracker::getInterval (this=0x0) at tracker.h:85 
85                      Uint32 getInterval() const {return interval;} 
(gdb) bt 
#0  0xb7e19152 in bt::Tracker::getInterval (this=0x0) at tracker.h:85 
#1  0xb7e16da4 in bt::PeerSourceManager::getTimeToNextUpdate (this=0x832d720) at peersourcemanager.cpp:433 
#2  0xb7dd26d0 in bt::TorrentControl::getTimeToNextTrackerUpdate (this=0x832ce88) at torrentcontrol.cpp:914 
#3  0xb349339d in kt::TrackerView::update (this=0x8433df8, ti=0x832ce88) at trackerview.cpp:162 
#4  0xb3486654 in kt::InfoWidget::update (this=0x8408b68) at infowidget.cpp:385 
#5  0xb3487b3e in kt::InfoWidget::changeTC (this=0x8408b68, tc=0x832ce88) at infowidget.cpp:324 
#6  0xb347dd87 in kt::InfoWidgetPlugin::currentTorrentChanged (this=0x84081f8, tc=0x832ce88) at infowidgetplugin.cpp:81 
#7  0xb7e3c70e in kt::GUIInterface::notifyViewListeners (this=0x81ad75c, tc=0x832ce88) at guiinterface.cpp:40 
#8  0x080660ea in KTorrent::currentTorrentChanged (this=0x81ad5f8, tc=0x832ce88) at ktorrent.cpp:403 
#9  0x08068a30 in KTorrent::qt_invoke (this=0x81ad5f8, _id=169, _o=0xbfd1d25c) at ktorrent.moc:189 
#10 0xb705f8c9 in QObject::activate_signal () from /usr/qt/3/lib/libqt-mt.so.3 
#11 0x0806e1e2 in KTorrentView::currentChanged (this=0x82022b0, t0=0x832ce88) at ktorrentview.moc:208 
#12 0x0806f67f in KTorrentView::onExecuted (this=0x82022b0, item=0x832c100) at ktorrentview.cpp:391 
#13 0x08070a8c in KTorrentView::qt_invoke (this=0x82022b0, _id=122, _o=0xbfd1d354) at ktorrentview.moc:314 
#14 0xb705f8c9 in QObject::activate_signal () from /usr/qt/3/lib/libqt-mt.so.3 
#15 0xb73a5141 in QListView::currentChanged () from /usr/qt/3/lib/libqt-mt.so.3 
#16 0xb713f197 in QListView::setCurrentItem () from /usr/qt/3/lib/libqt-mt.so.3 
#17 0xb71420bf in QListView::contentsMousePressEventEx () from /usr/qt/3/lib/libqt-mt.so.3 
#18 0xb7142a54 in QListView::contentsMousePressEvent () from /usr/qt/3/lib/libqt-mt.so.3 
#19 0xb7816fcb in KListView::contentsMousePressEvent () from /usr/kde/3.5/lib/libkdeui.so.4
Comment 2 Clara Gnos 2006-09-14 10:43:25 UTC
Created attachment 17766 [details]
SVGView.exe.torrent

Torrent where it happens for example (created with 3 dht-nodes using bittorrent
4.20.9)
Comment 3 Joris Guisson 2006-09-14 18:16:21 UTC
SVN commit 584383 by guisson:

Fixed crash, forgot to check for a NULL pointer.

BUG: 134054



 M  +1 -1      peersourcemanager.cpp  


--- trunk/extragear/network/ktorrent/libktorrent/torrent/peersourcemanager.cpp #584382:584383
@@ -427,7 +427,7 @@
 	
 	Uint32 PeerSourceManager::getTimeToNextUpdate() const
 	{
-		if (pending || !started)
+		if (pending || !started || !curr)
 			return 0;
 		
 		return curr->getInterval() - request_time.secsTo(QDateTime::currentDateTime());