fix crash in windows launcher

This commit is contained in:
Chris Forbes
2011-01-11 11:25:50 +13:00
parent a25087a9f3
commit d835c14988
2 changed files with 8 additions and 2 deletions

View File

@@ -29,8 +29,14 @@ namespace OpenRA.Launcher
}
Dictionary<string, Download> downloads = new Dictionary<string,Download>();
readonly Control hostControl;
HtmlDocument document = null;
public JSBridge(Control hostControl)
{
this.hostControl = hostControl;
}
public HtmlDocument Document
{
get { return document; }
@@ -177,7 +183,7 @@ namespace OpenRA.Launcher
using (var reader = new StreamReader(pipe))
{
var data = reader.ReadToEnd();
Form.ActiveForm.Invoke((Delegate)(Action)(() =>
hostControl.Invoke((Delegate)(Action)(() =>
document.InvokeScript(callbackName, new object[] { data })));
}
}, url);

View File

@@ -30,7 +30,7 @@ namespace OpenRA.Launcher
Util.UacShield(installButton);
webBrowser.ObjectForScripting = new JSBridge();
webBrowser.ObjectForScripting = new JSBridge(this);
webBrowser.DocumentCompleted += (o, e) =>
{
var b = o as WebBrowser;