Bug 228804 - crash after trying to delete on list old download that not exist
Summary: crash after trying to delete on list old download that not exist
Status: RESOLVED FIXED
Alias: None
Product: kget
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: KGet authors
URL:
Keywords:
: 238783 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-02-27 20:54 UTC by Michał Kudła
Modified: 2010-05-25 23:20 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michał Kudła 2010-02-27 20:54:05 UTC
Application: kget (2.4.0)
KDE Platform Version: 4.4.00 (KDE 4.4.0) (Compiled from sources)
Qt Version: 4.6.2
Operating System: Linux 2.6.32-gentoo-r6 i686
Distribution (Platform): Gentoo Packages

-- Information about the crash:
crash after trying to delete on list old download that not exist.

$ kget
QApplication::qAppName: Please instantiate the QApplication object first
Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
kget(699)/nepomuk (library) <unnamed>::GlobalModelContainer::init: Connecting to local socket "/mnt/work/home/m1k0/.kde4/share/apps/nepomuk/socket"
kget(699)/kdecore (KSycoca) KSycocaPrivate::openDatabase: Trying to open ksycoca from  "/var/tmp/kdecache-m1k0/ksycoca4"                           
kget(699) KGet::loadPlugins:  TransferFactory plugin found:                                                                                        
rank =  30                                                                                                                                         
plugintype =  QVariant(QString, "TransferFactory")                                                                                                 
kget(699) KGet::loadPlugins:  TransferFactory plugin found:                                                                                        
rank =  110                                                                                                                                        
plugintype =  QVariant(QString, "TransferFactory")                                                                                                 
kget(699) KGet::loadPlugins:  TransferFactory plugin found:                                                                                        
rank =  70                                                                                                                                         
plugintype =  QVariant(QString, "TransferFactory")                                                                                                 
kget(699) KGet::loadPlugins:  TransferFactory plugin found:                                                                                        
rank =  90                                                                                                                                         
plugintype =  QVariant(QString, "TransferFactory")                                                                                                 
kget(699) KGet::loadPlugins:  TransferFactory plugin found:                                                                                        
rank =  40                                                                                                                                         
plugintype =  QVariant(QString, "TransferFactory")                                                                                                 
kget(699) KGet::loadPlugins:  TransferFactory plugin found:                                                                                        
rank =  200                                                                                                                                        
plugintype =  QVariant(QString, "TransferFactory")                                                                                                 
kget(699) KGet::loadPlugins:  TransferFactory plugin found:                                                                                        
rank =  50                                                                                                                                         
plugintype =  QVariant(QString, "TransferFactory")                                                                                                 
kget(699) KGet::loadPlugins: TransferFactory plugin ( "kget_checksumsearchfactory" ) found and added to the list of available plugins              
kget(699) KGet::loadPlugins: TransferFactory plugin ( "kget_mirrorsearchfactory" ) found and added to the list of available plugins                
kget(699) KGet::loadPlugins: TransferFactory plugin ( "kget_kiofactory" ) found and added to the list of available plugins                         
kget(699) KGet::loadPlugins: TransferFactory plugin ( "kget_multisegkiofactory" ) found and added to the list of available plugins                 
kget(699) KGet::loadPlugins: TransferFactory plugin ( "kget_metalinkfactory" ) found and added to the list of available plugins                    
kget(699) KGet::loadPlugins: TransferFactory plugin ( "kget_contentfetchfactory" ) found, but not enabled                                          
kget(699) KGet::loadPlugins: TransferFactory plugin ( "kget_bittorrentfactory" ) found and added to the list of available plugins                  
kget(699) KGet::loadPlugins: Number of factories =  6                                                                                              
kget(699) KGet::addGroup:                                                                                                                          
kget(699) ButtonBase::slotToggled:                                                                                                                 
kget(699) TransfersView::setModel: openEditor for row  0                                                                                           
kget(699) ViewsContainer::showDownloadsWindow: ViewsContainer::showDownloadsWindow                                                                 
kget(699) KGet::load: ( "/mnt/work/home/m1k0/.kde4/share/apps/kget/transfers.kgt" )                                                                
kget(699) KGet::load: file: "/mnt/work/home/m1k0/.kde4/share/apps/kget/transfers.kgt"                                                              
m1k0@laptok /mnt/work/home/m1k0 $ kget(699) KGet::load: KGet::load  -> group =  "Moje pobierania"                                                  
kget(699) KGet::load: KGet::load  -> group found                                                                                                   
kget(699) TransferGroup::load: TransferGroup::load                                                                                                 
kget(699) TransferGroup::load: TransferGroup::load -> addTransfer                                                                                  
kget(699) KGet::addTransfer:  src=  "file:///mnt/work/home/m1k0/.kde4/share/apps/kget/tmp/Wall-E+2008+%5BDVDRip.XViD%5D+%5BDubbing+PL%5D_ST2709364.torrent"  dest=  "file:///home/m1k0/Pobrane/%5BSUMOTorrent.com%5D_Wall-E_2008_%5BDVDRip.XViD%5D_%5BDubbing_PL%5D_ST2709364.torrent"  group=  "Moje pobierania"                                                     
kget(699) KGet::isValidDestDirectory: "/home/m1k0/Pobrane"                                                                                                                         
kget(699) KGet::createTransfer: srcUrl=  "file:///mnt/work/home/m1k0/.kde4/share/apps/kget/tmp/Wall-E+2008+%5BDVDRip.XViD%5D+%5BDubbing+PL%5D_ST2709364.torrent"    destUrl=  "file:///home/m1k0/Pobrane/%5BSUMOTorrent.com%5D_Wall-E_2008_%5BDVDRip.XViD%5D_%5BDubbing_PL%5D_ST2709364.torrent" group= _ "Moje pobierania" _                                         
kget(699) KGet::createTransfer: Trying plugin   n.plugins= 6                                                                                                                       
kget(699) BTTransferFactory::createTransfer: BTTransferFactory::createTransfer                                                                                                     
kget(699) Job::setStartStatus: Setting start status to  2                                                                                                                          
kget(699) BTTransfer::setSpeedLimits:                                                                                                                                              
kget(699) BTTransfer::setSpeedLimits:                                                                                                                                              
kget(699) TransferGroup::append: TransferGroup::append                                                                                                                             
kget(699) Scheduler::updateQueue: Scheduler: Evaluating job  0                                                                                                                     
kget(699) Scheduler::updateQueue: Scheduler:    starting job                                                                                                                       
kget(699) BTTransfer::btTransferInit:
kget(699) BTTransfer::btTransferInit: Source: "/mnt/work/home/m1k0/.kde4/share/apps/kget/tmp/Wall-E+2008+[DVDRip.XViD]+[Dubbing+PL]_ST2709364.torrent" Destination: "/home/m1k0/Pobrane/[SUMOTorrent.com]_Wall-E_2008_[DVDRip.XViD]_[Dubbing_PL]_ST2709364.torrent"
kget(699) Scheduler::jobChangedEvent: Scheduler::jobChangedEvent  (job= BTTransfer(0x864b4b0)  status= 3 )
kget(699) Scheduler::jobChangedEvent: job =  BTTransfer(0x864b4b0)  failure (# 0 ) = Abort
kget(699) TransferGroup::calculateSpeedLimits: We will calculate the new SpeedLimits now
kget(699) TransferGroup::calculateDownloadLimit: "Calculate new DownloadLimit of 0"
kget(699) TransferGroup::calculateUploadLimit: "Calculate new Upload Limit of 0"
kget(699) TransfersView::rowsInserted: TransfersView::rowsInserted
kget(699) KUiServerJobs::slotTransferAdded:
kget(699)/kdeui (KNotification) KStatusNotifierItemDBus::KStatusNotifierItemDBus: service is "org.kde.StatusNotifierItem-699-1"
kget(699)/kdeui (KNotification) KStatusNotifierItemPrivate::registerToDaemon: Registering a client interface to the KStatusNotifierWatcher
QWidget::insertAction: Attempt to insert null action
kget(699) KGet::allTransferGroups: "Moje pobierania"
kget(699) KGet::allTransferGroups: "Moje pobierania"
kget(699) TransferGroup::calculateDownloadLimit: "Calculate new DownloadLimit of 0"
kget(699) KGet::allTransferGroups: "Moje pobierania"
kget(699) TransferGroupScheduler::calculateUploadLimit: 1
kget(699) KGet::allTransferGroups: "Moje pobierania"
kget(699) TransferGroup::calculateUploadLimit: "Calculate new Upload Limit of 0"
kget(699) Job::setPolicy: Job::setPolicy( 1 )
kget(699) Scheduler::updateQueue: Scheduler: Evaluating job  0
kget(699) ViewsContainer::showDownloadsWindow: ViewsContainer::showDownloadsWindow
kget(699) SQLiteStore::saveItem: "constraint failed Nie można pobrać rzędu"
kget(699) TransferHandler::destroy: TransferHandler::destroy() ENTERING
kget(699) TransferHandler::destroy: TransferHandler::destroy() LEAVING
KCrash: crashing... crashRecursionCounter = 2
KCrash: Application Name = kget path = /usr/bin pid = 699
sock_file=/home/m1k0/.kde4/socket-laptok/kdeinit4__0



 -- Backtrace:
Application: KGet (kget), signal: Segmentation fault
[KCrash Handler]
#6  0xaffa1e39 in bt::ChunkManager::deleteDataFiles (this=0x0) at /var/tmp/portage/kde-base/kget-4.4.0/work/kget-4.4.0/kget/transfer-plugins/bittorrent/libbtcore/diskio/chunkmanager.cpp:1095
#7  0xaff5f6ce in bt::TorrentControl::deleteDataFiles (this=0x84fbaa8)
    at /var/tmp/portage/kde-base/kget-4.4.0/work/kget-4.4.0/kget/transfer-plugins/bittorrent/libbtcore/torrent/torrentcontrol.cpp:1410
#8  0xafeacdb0 in BTTransfer::deinit (this=0x85b9630) at /var/tmp/portage/kde-base/kget-4.4.0/work/kget-4.4.0/kget/transfer-plugins/bittorrent/bttransfer.cpp:99
#9  0xb71448a0 in Transfer::destroy (this=0x85b9630) at /var/tmp/portage/kde-base/kget-4.4.0/work/kget-4.4.0/kget/core/transfer.cpp:80
#10 0xb712d71b in KGet::delTransfer (transfer=0x8617aa8) at /var/tmp/portage/kde-base/kget-4.4.0/work/kget-4.4.0/kget/core/kget.cpp:338
#11 0x080f1cd3 in MainWindow::slotDeleteSelected (this=0x83d2d40) at /var/tmp/portage/kde-base/kget-4.4.0/work/kget-4.4.0/kget/mainwindow.cpp:670
#12 0x080f4204 in MainWindow::qt_metacall (this=0x83d2d40, _c=QMetaObject::InvokeMetaMethod, _id=28, _a=0xbfa7a2e8)
    at /var/tmp/portage/kde-base/kget-4.4.0/work/kget-4.4.0_build/kget/mainwindow.moc:172
#13 0xb67c54ee in QMetaObject::metacall (object=0x83d2d40, cl=QMetaObject::InvokeMetaMethod, idx=74, argv=0xbfa7a2e8) at kernel/qmetaobject.cpp:237
#14 0xb67d95b7 in QMetaObject::activate (sender=0x84cb590, m=0xb6618078, local_signal_index=1, argv=0xbfa7a2e8) at kernel/qobject.cpp:3285
#15 0xb5b469d5 in QAction::triggered (this=0x84cb590, _t1=false) at .moc/debug-shared/moc_qaction.cpp:263
#16 0xb5b45ea0 in QAction::activate (this=0x84cb590, event=QAction::Trigger) at kernel/qaction.cpp:1255
#17 0xb5b47024 in QAction::trigger (this=0x84cb590) at kernel/qaction.h:218
#18 0xb60e266a in QToolButton::nextCheckState (this=0x84e0098) at widgets/qtoolbutton.cpp:1147
#19 0xb5fdb164 in QAbstractButtonPrivate::click (this=0x84de978) at widgets/qabstractbutton.cpp:528
#20 0xb5fdc8c4 in QAbstractButton::mouseReleaseEvent (this=0x84e0098, e=0xbfa7ac1c) at widgets/qabstractbutton.cpp:1121
#21 0xb60e0f4f in QToolButton::mouseReleaseEvent (this=0x84e0098, e=0xbfa7ac1c) at widgets/qtoolbutton.cpp:721
#22 0xb5bc25d3 in QWidget::event (this=0x84e0098, event=0xbfa7ac1c) at kernel/qwidget.cpp:7998
#23 0xb5fdc734 in QAbstractButton::event (this=0x84e0098, e=0xbfa7ac1c) at widgets/qabstractbutton.cpp:1080
#24 0xb60e26d9 in QToolButton::event (this=0x84e0098, event=0xbfa7ac1c) at widgets/qtoolbutton.cpp:1163
#25 0xb5b56b27 in QApplicationPrivate::notify_helper (this=0x8369eb8, receiver=0x84e0098, e=0xbfa7ac1c) at kernel/qapplication.cpp:4300
#26 0xb5b54bad in QApplication::notify (this=0xbfa7b468, receiver=0x84e0098, e=0xbfa7ac1c) at kernel/qapplication.cpp:3865
#27 0xb766f9c3 in KApplication::notify (this=0xbfa7b468, receiver=0x84e0098, event=0xbfa7ac1c) at /var/tmp/portage/kde-base/kdelibs-4.4.0/work/kdelibs-4.4.0/kdeui/kernel/kapplication.cpp:302
#28 0xb67bdf1c in QCoreApplication::notifyInternal (this=0xbfa7b468, receiver=0x84e0098, event=0xbfa7ac1c) at kernel/qcoreapplication.cpp:704
#29 0xb5b592c6 in QCoreApplication::sendSpontaneousEvent (receiver=0x84e0098, event=0xbfa7ac1c) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:218
#30 0xb5b531ba in QApplicationPrivate::sendMouseEvent (receiver=0x84e0098, event=0xbfa7ac1c, alienWidget=0x84e0098, nativeWidget=0x83d2d40, buttonDown=0xb6634678, lastMouseReceiver=..., 
    spontaneous=true) at kernel/qapplication.cpp:2963
#31 0xb5bf8e82 in QETWidget::translateMouseEvent (this=0x83d2d40, event=0xbfa7b140) at kernel/qapplication_x11.cpp:4368
#32 0xb5bf5ac0 in QApplication::x11ProcessEvent (this=0xbfa7b468, event=0xbfa7b140) at kernel/qapplication_x11.cpp:3379
#33 0xb5c2be0d in x11EventSourceDispatch (s=0x836cfa8, callback=0, user_data=0x0) at kernel/qguieventdispatcher_glib.cpp:146
#34 0xb56a8d13 in g_main_dispatch (context=0x836c090) at gmain.c:1960
#35 0xb56a9f6e in IA__g_main_context_dispatch (context=0x836c090) at gmain.c:2513
#36 0xb56aa38f in g_main_context_iterate (context=0x836c090, block=1, dispatch=1, self=0x83699b0) at gmain.c:2591
#37 0xb56aa560 in IA__g_main_context_iteration (context=0x836c090, may_block=1) at gmain.c:2654
#38 0xb67f5aa5 in QEventDispatcherGlib::processEvents (this=0x833d8a8, flags=...) at kernel/qeventdispatcher_glib.cpp:412
#39 0xb5c2c447 in QGuiEventDispatcherGlib::processEvents (this=0x833d8a8, flags=...) at kernel/qguieventdispatcher_glib.cpp:204
#40 0xb67bb2f0 in QEventLoop::processEvents (this=0xbfa7b3dc, flags=...) at kernel/qeventloop.cpp:149
#41 0xb67bb433 in QEventLoop::exec (this=0xbfa7b3dc, flags=...) at kernel/qeventloop.cpp:201
#42 0xb67be5fe in QCoreApplication::exec () at kernel/qcoreapplication.cpp:981
#43 0xb5b53e7d in QApplication::exec () at kernel/qapplication.cpp:3579
#44 0x080f6a51 in main (argc=2, argv=0xbfa7b674) at /var/tmp/portage/kde-base/kget-4.4.0/work/kget-4.4.0/kget/main.cpp:184

Reported using DrKonqi
Comment 1 Lukas Appelhans 2010-02-27 21:04:12 UTC
It should may by fixed inside btcore right?

Lukas
Comment 2 Joris Guisson 2010-02-28 10:03:34 UTC
This can only happen if the init function of the TorrentControl has not been called. Which should always be called when a torrent is loaded or created.
Comment 3 Lukas Appelhans 2010-02-28 11:50:28 UTC
Well init() is only called when I start the torrent in KGet... so it could happen if you add a torrent which has the initial state Stopped...

It doesn't crash for me though... that's what I worry about...

Lukas
Comment 4 Lukas Appelhans 2010-02-28 11:52:24 UTC
Edit: Well no, stupid me... then the torrent control pointer would be 0 as we create the torrent control short before initializing it...

So I'm back at having no clue :)

Lukas
Comment 5 Joris Guisson 2010-02-28 12:49:14 UTC
Could be a dangling pointer to an already destroyed TorrentControl
Comment 6 Michał Kudła 2010-02-28 13:10:59 UTC
mayby this bug linked to https://bugs.kde.org/show_bug.cgi?id=228877
Comment 7 Lukas Appelhans 2010-02-28 15:16:11 UTC
Mmh Joris, this seems impossible to me as the TorrentControl is only deleted on the destructor and Transfer::deinit() is only called before deleting a transfer...

Lukas
Comment 8 Joris Guisson 2010-03-01 17:56:30 UTC
Another possibility is that it could happen if something fails in TorrentControl::init and an exception is thrown before the ChunkManager is created. 

The most likely way is that loading the actual torrent file fails.

What does KGet do if init fails ?
Comment 9 Lukas Appelhans 2010-03-01 22:16:09 UTC
It sets the variable m_ready to false... I could add a check for this var before deleting the data...

Is this the only other way this could happen? :)

Lukas
Comment 10 Joris Guisson 2010-03-02 18:48:54 UTC
Yeah, the ChunkManager is made when init is called, and deleted when the TorrentControl is destroyed. 

I will add a check in deleteDataFiles, that will also prevent the crash from happening. But as a rule of thumb if init of a TorrentControl fails, just delete it and don't do anything with it.
Comment 11 Joris Guisson 2010-03-02 18:50:47 UTC
SVN commit 1098024 by guisson:

- Make it possible to change the ChunkSelector at runtime
- Check for cman being 0 in deleteDataFiles (should prevent 228804)

CCBUG: 228804

 M  +1 -0      ChangeLog  
 M  +14 -6     libbtcore/download/downloader.cpp  
 M  +4 -4      libbtcore/download/downloader.h  
 M  +4 -0      libbtcore/interfaces/torrentinterface.h  
 M  +19 -1     libbtcore/torrent/torrentcontrol.cpp  
 M  +1 -0      libbtcore/torrent/torrentcontrol.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1098024
Comment 12 Lukas Appelhans 2010-03-02 22:28:12 UTC
Ok great!

I will do that tomorrow...

Lukas
Comment 13 Lukas Appelhans 2010-05-25 23:20:43 UTC
*** Bug 238783 has been marked as a duplicate of this bug. ***