Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix LT-21934: fork task to stop parser so control returns to user #209

Merged
merged 5 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading