Fix crash if main window is closed while update check is ongoing

This commit is contained in:
baldurk
2015-10-04 15:31:10 +02:00
parent 90e1b5c1b1
commit c4d95421e0
+22 -14
View File
@@ -1065,13 +1065,17 @@ namespace renderdocui.Windows
if (response != "")
{
BeginInvoke((MethodInvoker)delegate
// window may have been closed while update check was on-going. If so, just return
if (Visible)
{
m_Core.Config.CheckUpdate_UpdateAvailable = true;
m_Core.Config.CheckUpdate_UpdateResponse = response;
SetUpdateAvailable();
UpdatePopup();
});
BeginInvoke((MethodInvoker)delegate
{
m_Core.Config.CheckUpdate_UpdateAvailable = true;
m_Core.Config.CheckUpdate_UpdateResponse = response;
SetUpdateAvailable();
UpdatePopup();
});
}
result = UpdateResult.Upgrade;
}
else if (callback != null)
@@ -1092,15 +1096,19 @@ namespace renderdocui.Windows
// and it's not worth trying to retry.
}
BeginInvoke((MethodInvoker)delegate
// window may have been closed while update check was on-going. If so, just return
if (Visible)
{
statusText.Text = "";
statusProgress.Visible = false;
statusProgress.Style = ProgressBarStyle.Continuous;
statusProgress.MarqueeAnimationSpeed = 0;
if (callback != null && result != UpdateResult.Disabled)
callback(result);
});
BeginInvoke((MethodInvoker)delegate
{
statusText.Text = "";
statusProgress.Visible = false;
statusProgress.Style = ProgressBarStyle.Continuous;
statusProgress.MarqueeAnimationSpeed = 0;
if (callback != null && result != UpdateResult.Disabled)
callback(result);
});
}
}));
updateThread.Start();