Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/13/17 14:21:09 (7 years ago)
Author:
pfleck
Message:

#2846: Fixed uncaught ObjectDisposedException in HiveJobManagerView.

  • Caught a potential NullReferenceException in the HiveClient when ClearHiveClient is called asynchronous.
  • Use Task.Run for HiveClient.Refresh instead of Begin/EndInvoke.
  • Use await with try-catch to marshal back any uncaught exceptions back to the UI-thread where the exception is displayed instead of HL crashing.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveJobManagerView.cs

    r14185 r15419  
    6161    }
    6262
    63     protected override void OnContentChanged() {
     63    protected async override void OnContentChanged() {
    6464      base.OnContentChanged();
    6565      if (Content == null) {
     
    6767      } else {
    6868        hiveExperimentListView.Content = Content.Jobs;
    69         if (Content != null)
    70           Content.RefreshAsync(new Action<Exception>((Exception ex) => HandleServiceException(ex)));
     69        if (Content != null) {
     70          try {
     71            await System.Threading.Tasks.Task.Run(() => Content.Refresh());
     72          } catch (Exception ex) {
     73            HandleServiceException(ex);
     74          }
     75        }
    7176      }
    7277    }
     
    98103    }
    99104
    100     private void refreshButton_Click(object sender, EventArgs e) {
    101       Content.RefreshAsync(new Action<Exception>((Exception ex) => HandleServiceException(ex)));
     105    private async void refreshButton_Click(object sender, EventArgs e) {
     106      try {
     107        await System.Threading.Tasks.Task.Run(() => Content.Refresh());
     108      } catch (Exception ex) {
     109        HandleServiceException(ex);
     110      }
    102111    }
    103112
Note: See TracChangeset for help on using the changeset viewer.