summaryrefslogtreecommitdiffstats
path: root/win/CS
diff options
context:
space:
mode:
authorsr55 <[email protected]>2012-05-27 17:29:52 +0000
committersr55 <[email protected]>2012-05-27 17:29:52 +0000
commitb225737b50c5cf584f9099c90dbcad939c2d6067 (patch)
tree301a29d863cb892d30e519c9aaebf44a8e56f527 /win/CS
parent0464170f84054a57f6200084f02783e679c1f768 (diff)
WinGui: Fix a threading bug in the Queue Manger. ClearCompleted should always be done on the UI Thread. This was causing the "Clear completed" queue option to crash.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4707 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS')
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/QueueManager.cs22
1 files changed, 14 insertions, 8 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Services/QueueManager.cs b/win/CS/HandBrake.ApplicationServices/Services/QueueManager.cs
index 1ce362449..d80ee0660 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/QueueManager.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/QueueManager.cs
@@ -13,6 +13,8 @@ namespace HandBrake.ApplicationServices.Services
using System.Windows.Forms;
using System.Xml.Serialization;
+ using Caliburn.Micro;
+
using HandBrake.ApplicationServices.Exceptions;
using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Services.Interfaces;
@@ -74,7 +76,7 @@ namespace HandBrake.ApplicationServices.Services
/// </summary>
public QueueManager()
{
- this.queueFile = "hb_queue_recovery.xml"; // TODO need to support multi-instance here.
+ this.queueFile = "hb_queue_recovery.xml"; // TODO need to support multi-instance here.
}
/// <summary>
@@ -196,12 +198,16 @@ namespace HandBrake.ApplicationServices.Services
/// </summary>
public void ClearCompleted()
{
- List<QueueTask> deleteList = this.queue.Where(task => task.Status == QueueItemStatus.Completed).ToList();
- foreach (QueueTask item in deleteList)
- {
- this.queue.Remove(item);
- }
- this.InvokeQueueChanged(EventArgs.Empty);
+ Execute.OnUIThread(
+ () =>
+ {
+ List<QueueTask> deleteList = this.queue.Where(task => task.Status == QueueItemStatus.Completed).ToList();
+ foreach (QueueTask item in deleteList)
+ {
+ this.queue.Remove(item);
+ }
+ this.InvokeQueueChanged(EventArgs.Empty);
+ });
}
/// <summary>
@@ -324,7 +330,7 @@ namespace HandBrake.ApplicationServices.Services
try
{
- list = serializer.Deserialize(strm) as List<QueueTask>;
+ list = serializer.Deserialize(strm) as List<QueueTask>;
}
catch (Exception exc)
{