component: MainForm.WindowsForms | priority: medium
2020-05-15 18:00:19: @gkronber created the issue
There is a race condition in the AsynchronousContentView whereby in the following code 'result' is null, or already disposed within the WaitOrTimerCallback. This leads to a KeyNotFoundExceptionException in the callback and consequently a crash of HL. The error is hard to reproduce but usually occurs when algorithms are running and working with the Hive Job Manager (which often locks views and shows progress bars).
#!csharp
/// Asynchronous call of GUI updating.
/// </summary>
/// <param name="method">The delegate to invoke.</param>
/// <param name="args">The invoke arguments.</param>
protected new void Invoke(Delegate method, params object[] args) {
// prevents blocking of worker thread in Invoke, if the control is disposed
IAsyncResult result = BeginInvoke(method, args);
result.AsyncWaitHandle.WaitOne(1000, false);
if (result.IsCompleted) try { EndInvoke(result); }
catch (ObjectDisposedException) { } else {
ThreadPool.RegisterWaitForSingleObject(result.AsyncWaitHandle,
new WaitOrTimerCallback((x, b) => { try { EndInvoke(result); } catch (ObjectDisposedException) { } }),
null, -1, true);
}
}
Issue migrated from trac ticket # 3069
component: MainForm.WindowsForms | priority: medium
2020-05-15 18:00:19: @gkronber created the issue