From 1063c4f0f2ca106fb593d1c90195372aeabe4ef2 Mon Sep 17 00:00:00 2001 From: Markus Ewald Date: Wed, 18 Jun 2008 19:20:25 +0000 Subject: [PATCH] Fixed a glaring bug in the ProgressReporter which could throw exceptions into the ProgressChanged event handler (race condition between dialog setup and first progress message) git-svn-id: file:///srv/devel/repo-conversion/nuwi@21 d2e56fa2-650e-0410-a79f-9358c0239efd --- Source/ProgressReporter/ProgressReporterForm.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Source/ProgressReporter/ProgressReporterForm.cs b/Source/ProgressReporter/ProgressReporterForm.cs index 00c2732..0e30f19 100644 --- a/Source/ProgressReporter/ProgressReporterForm.cs +++ b/Source/ProgressReporter/ProgressReporterForm.cs @@ -104,6 +104,11 @@ namespace Nuclex.Windows.Forms { this.abortReceiver = (progression as IAbortable); this.cancelButton.Enabled = (this.abortReceiver != null); + // Make sure the progress bar control has been created (otherwise, we've got + // a chance that BeginInvoke() would fail if the first progress notification + // arrived before we called ShowDialog()!) + IntPtr tempDummy = this.progressBar.Handle; + // Subscribe the form to the progression it is supposed to monitor progression.AsyncEnded += this.asyncEndedDelegate; IProgressReporter progressReporter = progression as IProgressReporter;