Skip to content

Commit

Permalink
Fix LT-21934: fork task to stop parser so control returns to user (#209)
Browse files Browse the repository at this point in the history
* Fix LT-21934: fork task to stop parser so control returns to user

* LT-21934: Remove Stopping and Updating variables

* Remove unused variables

---------

Co-authored-by: Jake Oliver <jeoliver97@gmail.com>
  • Loading branch information
jtmaxwell3 and JakeOliver28 authored Nov 25, 2024
1 parent 3f0ddc9 commit 1a3797b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
11 changes: 11 additions & 0 deletions Src/LexText/ParserCore/ParserScheduler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using SIL.LCModel;
using SIL.ObjectModel;
using XCore;
using System.Threading;

namespace SIL.FieldWorks.WordWorks.Parser
{
Expand Down Expand Up @@ -196,6 +197,16 @@ public bool TryAWordDialogIsRunning
}

protected override void DisposeManagedResources()
{
// Dispose the managed resources in a separate thread
// so that the user gets control back right away.
System.Threading.Tasks.Task.Run(() =>
{
FinishDisposeManagedResources();
});
}

private void FinishDisposeManagedResources()
{
m_thread.Stop();
m_thread.Dispose();
Expand Down
9 changes: 0 additions & 9 deletions Src/LexText/ParserUI/ParserUIStrings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions Src/LexText/ParserUI/ParserUIStrings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,4 @@
<data name="ksEnterComment" xml:space="preserve">
<value>Please enter a comment for the parser report</value>
</data>
<data name="ksStoppingParser" xml:space="preserve">
<value>Stopping the Parser (may take up to a minute)</value>
</data>
</root>
1 change: 0 additions & 1 deletion Src/LexText/ParserUI/TryAWordDlg.cs
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,6 @@ protected override void OnClosed(EventArgs ea)
m_persistProvider.PersistWindowSettings(PersistProviderID, this);
if (m_parserListener.Connection != null)
{
this.Text = ParserUIStrings.ksStoppingParser;
m_parserListener.Connection.TryAWordDialogIsRunning = false;
m_parserListener.DisconnectFromParser();
}
Expand Down

0 comments on commit 1a3797b

Please sign in to comment.