Skip to content

Fix more problems with LT-22357#874

Open
jtmaxwell3 wants to merge 1 commit into
mainfrom
LT-22357b
Open

Fix more problems with LT-22357#874
jtmaxwell3 wants to merge 1 commit into
mainfrom
LT-22357b

Conversation

@jtmaxwell3
Copy link
Copy Markdown
Collaborator

@jtmaxwell3 jtmaxwell3 commented May 8, 2026

This fixes more problems with https://jira.sil.org/browse/LT-22357 by widening the scope of try ... catch expressions and adding more guards.


This change is Reviewable

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 8, 2026

NUnit Tests

    1 files  ±0      1 suites  ±0   6m 17s ⏱️ -24s
4 102 tests ±0  4 031 ✅ ±0  71 💤 ±0  0 ❌ ±0 
4 111 runs  ±0  4 040 ✅ ±0  71 💤 ±0  0 ❌ ±0 

Results for commit 09612b6. ± Comparison against base commit c3b063a.

Copy link
Copy Markdown
Contributor

@johnml1135 johnml1135 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Draft review comments

m_synchronizeInvoke.Invoke((Action)m_progressDialog.Close, null);
else
m_progressDialog.Close();
if (m_progressDialog != null)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drafted with the help of GPT 5.5: The new m_progressDialog != null guard helps, but this is still a check-then-use race: the dialog/control can be disposed after the null check and before Invoke / Close. Could this close path use the same scoped teardown-safe helper as the property setters, or at least catch the same expected teardown exceptions here too?

progress.Message = xWorksStrings.ksObtainingEntriesToDisplay;
var configuration = new DictionaryConfigurationModel(configurationFile, Cache);
publicationDecorator.Refresh();
if (Clerk.IsDisposed)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drafted with the help of GPT 5.5: Could we capture Clerk once and use that same reference for the disposed check, VirtualFlid, and the later SavePreviewHtmlWithStyles call? As written we check Clerk.IsDisposed, then later re-read Clerk.VirtualFlid, then pass Clerk again, which makes the teardown lifetime harder to reason about.

else
m_progressDialog.Message = value;
}
catch (Exception e)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drafted with the help of GPT 5.5: Optional: would it be worth adding a focused regression test around the progress-dialog wrapper with a synchronizing control/object that tears down mid-update? Even if the full Dictionary View import flow is hard to automate, a small test here would lock in that expected teardown exceptions are ignored while unexpected ones still surface.

else
m_progressDialog.Message = value;
}
catch (Exception e)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drafted with the help of GPT 5.5: Could we narrow this catch to the expected teardown exceptions instead of catching all Exception? The evidence here seems pretty specific: CheckDisposed() in this class throws ObjectDisposedException, Dispose(bool) nulls out m_progressDialog/m_worker, and the WinForms Control.BeginInvoke docs explicitly call out InvalidOperationException when no appropriate window handle can be found. The Control.Invoke / InvokeRequired docs also note exceptions if no appropriate handle exists or if the UI thread is no longer active. Unexpected exceptions here would still be useful to surface.

{
return null;
}
var entriesToPublish = publicationDecorator.GetEntriesToPublish(m_propertyTable, Clerk.VirtualFlid);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drafted with the help of GPT 5.5: In this same method we still do progress.Position++, but Position is not covered by the new LT-22357 handling and ++ here is a cross-thread read/modify/write. Would it be cleaner to switch callers like this to Step(1) and then make ProgressDialogWithTask.Step use the same teardown-safe helper as Message / Minimum / Maximum? That would collapse this to one marshaled UI operation instead of a getter+setter pair.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants