Opened 8 years ago
Closed 8 years ago
#2667 closed defect (done)
ObjectDisposedException might crash HL in ProgressView in combination with importing data from CSV file
Reported by: | gkronber | Owned by: | gkronber |
---|---|---|---|
Priority: | high | Milestone: | HeuristicLab 3.3.15 |
Component: | MainForm.WindowsForms | Version: | 3.3.14 |
Keywords: | Cc: |
Description
I got an exception in the following code when accessing progressBar since it has been disposed. It seems that a unfortunate order of execution might lead to this situation.
In my case it happened when importing data from a CSV file.
private void UpdateProgressValue() { if (InvokeRequired) Invoke((Action)UpdateProgressValue); else { if (content != null) { double progressValue = content.ProgressValue; if (progressValue <= 0.0 || progressValue > 1.0) { progressBar.Style = ProgressBarStyle.Marquee; } else { progressBar.Style = ProgressBarStyle.Blocks; progressBar.Value = (int)Math.Round(progressBar.Minimum + progressValue * (progressBar.Maximum - progressBar.Minimum)); } } } }
Change History (9)
comment:1 Changed 8 years ago by gkronber
comment:2 Changed 8 years ago by gkronber
Crash is still possible because of a possible context switch and race condition between the if and throw statements.
if (this.IsHandleCreated) throw;
comment:3 Changed 8 years ago by gkronber
r14297: catch all InvalidOperationExceptions (ObjectDisposedExceptions) for the invoke in ProgressView
comment:4 Changed 8 years ago by gkronber
- Status changed from new to accepted
comment:5 Changed 8 years ago by gkronber
- Component changed from Problems.DataAnalysis to MainForm.WindowsForms
- Owner changed from gkronber to abeham
- Status changed from accepted to reviewing
comment:6 Changed 8 years ago by gkronber
- Owner changed from abeham to jkarder
comment:7 Changed 8 years ago by jkarder
- Owner changed from jkarder to gkronber
- Status changed from reviewing to readytorelease
comment:8 Changed 8 years ago by gkronber
comment:9 Changed 8 years ago by gkronber
- Resolution set to done
- Status changed from readytorelease to closed
Note: See
TracTickets for help on using
tickets.
r14287: implemented a workaround. Hard to debug.