Opened 7 months ago

Last modified 6 months ago

#2667 reviewing defect

ObjectDisposedException might crash HL in ProgressView in combination with importing data from CSV file

Reported by: gkronber Owned by: jkarder
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 (6)

comment:1 Changed 6 months ago by gkronber

r14287: implemented a workaround. Hard to debug.

comment:2 Changed 6 months 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 6 months ago by gkronber

r14297: catch all InvalidOperationExceptions (ObjectDisposedExceptions) for the invoke in ProgressView

comment:4 Changed 6 months ago by gkronber

  • Status changed from new to accepted

comment:5 Changed 6 months 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 6 months ago by gkronber

  • Owner changed from abeham to jkarder
Note: See TracTickets for help on using tickets.