download queue bugfix

git-svn-id: svn://svn.berlios.de/gpodder/trunk@362 b0d088ad-0a06-0410-aad2-9ed5178a7e87
This commit is contained in:
Thomas Perl 2007-07-24 19:04:27 +00:00
parent d3b5a05bfe
commit a3e5286ac0
2 changed files with 19 additions and 0 deletions

View File

@ -1,3 +1,11 @@
Tue, 24 Jul 2007 21:02:01 +0200 <thp@perli.net>
* src/gpodder/libwget.py: Fix a bug in the download queue code that
would block the slots in the download queue when a currently-queued
download is cancelled before it has a chance to start the download;
this is fixed by simply aborting and de-registering the thread in
case the download is cancelled after acquiring the download queue
semaphore (should work now without problems :)
Tue, 24 Jul 2007 20:40:35 +0200 <thp@perli.net>
* src/gpodder/libwget.py: Add count() function to downloadStatusManager
* src/gpodder/gpodder.py: New download_status_updated callback

View File

@ -100,6 +100,17 @@ class downloadThread( object):
if self.statusmgr:
self.statusmgr.updateInfo( self.statusmgr_id, { 'episode':self.cutename, 'speed':_('Queued'), 'progress':0, 'url':self.url})
acquired = self.statusmgr.s_acquire()
# if after acquiring the lock, we are already cancelled,
# the user has cancelled this download while it was queued
if self.is_cancelled:
self.statusmgr.unregisterId( self.statusmgr_id)
if self.ready_event != None:
self.ready_event.set()
if acquired:
self.statusmgr.s_release()
return
process = popen2.Popen3( command, True)
self.pid = process.pid