diff options
author | Mike Krüger <mkrueger@novell.com> | 2011-01-31 17:11:36 +0300 |
---|---|---|
committer | Mike Krüger <mkrueger@novell.com> | 2011-01-31 17:12:26 +0300 |
commit | f52e8164188f5642b792dab0464e59ea3a216b1e (patch) | |
tree | f964fbef1ee4f07a047ace5f64fe23a09d05f50e /main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.Editor/POEditorWidget.cs | |
parent | 881419566898eba892ccfe90a6b771877e36cad3 (diff) |
Fixed possible threading issue in gettext addin.
Diffstat (limited to 'main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.Editor/POEditorWidget.cs')
-rw-r--r-- | main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.Editor/POEditorWidget.cs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.Editor/POEditorWidget.cs b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.Editor/POEditorWidget.cs index ec854b4ed3..2e05ab12fc 100644 --- a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.Editor/POEditorWidget.cs +++ b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.Editor/POEditorWidget.cs @@ -73,7 +73,6 @@ namespace MonoDevelop.Gettext AddTextview (0); UpdateFromCatalog (); UpdateProgressBar (); - UpdateTasks (); } } @@ -233,7 +232,6 @@ namespace MonoDevelop.Gettext }; widgets.Add (this); - UpdateTasks (); checkbuttonWhiteSpaces.Toggled += CheckbuttonWhiteSpacesToggled; options.ShowLineNumberMargin = false; @@ -465,6 +463,7 @@ namespace MonoDevelop.Gettext Catalog newCatalog = new Catalog(project); newCatalog.Load (null, catalog.FileName); this.Catalog = newCatalog; + UpdateTasks (); } Mono.TextEditor.TextEditor GetTextView (int index) @@ -1169,9 +1168,15 @@ namespace MonoDevelop.Gettext void StopTaskWorkerThread () { updateTaskThread.CancelAsync (); - while (updateTaskThread.IsBusy) { + int count = 0; + while (count++ < 5 && updateTaskThread.IsBusy) { Thread.Sleep (20); } + updateTaskThread.Dispose (); + updateTaskThread = new BackgroundWorker (); + updateTaskThread.WorkerSupportsCancellation = true; + updateTaskThread.DoWork += TaskUpdateWorker; + } void UpdateTasks () |