[banshee/stable-2.6] PrimarySource: prevent AddTrackJob respawn if cancelled (bgo#684089)



commit 07fdacbd717bee799b703dc2080c46750c7b6ea3
Author: Nicholas Little <arealityfarbetween googlemail com>
Date:   Wed Jan 16 21:42:56 2013 +0000

    PrimarySource: prevent AddTrackJob respawn if cancelled (bgo#684089)
    
    When the add_track_job object got cancelled by the user, the method
    IncrementAddedTracks was resetting it to null after having checked that
    its IsFinished property was True. IsFinished returns True if the job has
    finished normally and if it was cancelled. For the former, this code flow
    would work because it would be set to null in the last iteration, and
    would not be queried again. But in the case of a cancellation, next
    iteration of the foreach would check if (AddTrackJob.IsCancelRequested),
    which would create a new UserJob again (as AddTrackJob is a property that
    wraps add_track_job but creates one if it is null).
    
    The best and most simple way to fix this is simply never reset
    add_track_job to null until the loop has finished.
    
    Signed-off-by: Andres G. Aragoneses <knocte gmail com>

 .../Banshee.Sources/PrimarySource.cs               |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs 
b/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs
index 8f71ede..a1250ec 100644
--- a/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs
+++ b/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs
@@ -654,6 +654,7 @@ namespace Banshee.Sources
             if (!AddTrackJob.IsFinished) {
                 AddTrackJob.Finish ();
             }
+            add_track_job = null;
             is_adding = false;
         }
 
@@ -666,7 +667,6 @@ namespace Banshee.Sources
 
                 if (add_track_job.IsFinished) {
                     finished = true;
-                    add_track_job = null;
                 } else {
                     if (add_track_job.Completed % 10 == 0)
                         notify = true;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]