never allow html to be null. fixes #933

This commit is contained in:
Hylke Bons 2012-10-20 20:27:17 +01:00
parent 7e1cb40038
commit 94143df2e6
4 changed files with 17 additions and 22 deletions

View file

@ -263,12 +263,6 @@ namespace SparkleShare {
public void UpdateContent (string html) public void UpdateContent (string html)
{ {
Thread thread = new Thread (() => { Thread thread = new Thread (() => {
if (html == null)
html = Controller.HTML;
if (html == null)
return;
string pixmaps_path = IO.Path.Combine (SparkleUI.AssetsPath, "pixmaps"); string pixmaps_path = IO.Path.Combine (SparkleUI.AssetsPath, "pixmaps");
string icons_path = new string [] {SparkleUI.AssetsPath, "icons", string icons_path = new string [] {SparkleUI.AssetsPath, "icons",
"hicolor", "12x12", "status"}.Combine (); "hicolor", "12x12", "status"}.Combine ();

View file

@ -372,9 +372,6 @@ namespace SparkleShare {
new ThreadStart (delegate { new ThreadStart (delegate {
using (var a = new NSAutoreleasePool ()) using (var a = new NSAutoreleasePool ())
{ {
if (html == null)
html = Controller.HTML;
string pixmaps_path = "file://" + Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps"); string pixmaps_path = "file://" + Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps");
html = html.Replace ("<!-- $body-font-family -->", "Lucida Grande"); html = html.Replace ("<!-- $body-font-family -->", "Lucida Grande");

View file

@ -80,7 +80,9 @@ namespace SparkleShare {
if (watch.ElapsedMilliseconds < delay) if (watch.ElapsedMilliseconds < delay)
Thread.Sleep (delay - (int) watch.ElapsedMilliseconds); Thread.Sleep (delay - (int) watch.ElapsedMilliseconds);
UpdateContentEvent (html); if (!string.IsNullOrEmpty (html))
UpdateContentEvent (html);
UpdateSizeInfoEvent (Size, HistorySize); UpdateSizeInfoEvent (Size, HistorySize);
}).Start (); }).Start ();
@ -171,8 +173,11 @@ namespace SparkleShare {
UpdateChooserEvent (Folders); UpdateChooserEvent (Folders);
UpdateChooserEnablementEvent (true); UpdateChooserEnablementEvent (true);
UpdateContentEvent (html);
UpdateSizeInfoEvent (Size, HistorySize); if (!string.IsNullOrEmpty (html))
UpdateContentEvent (html);
UpdateSizeInfoEvent (Size, HistorySize);
}).Start (); }).Start ();
} }
@ -200,7 +205,9 @@ namespace SparkleShare {
if (watch.ElapsedMilliseconds < delay) if (watch.ElapsedMilliseconds < delay)
Thread.Sleep (delay - (int) watch.ElapsedMilliseconds); Thread.Sleep (delay - (int) watch.ElapsedMilliseconds);
UpdateContentEvent (html); if (!string.IsNullOrEmpty (html))
UpdateContentEvent (html);
UpdateSizeInfoEvent (Size, HistorySize); UpdateSizeInfoEvent (Size, HistorySize);
}; };
@ -285,7 +292,8 @@ namespace SparkleShare {
if (watch.ElapsedMilliseconds < delay) if (watch.ElapsedMilliseconds < delay)
Thread.Sleep (delay - (int) watch.ElapsedMilliseconds); Thread.Sleep (delay - (int) watch.ElapsedMilliseconds);
UpdateContentEvent (html); if (!string.IsNullOrEmpty (html))
UpdateContentEvent (html);
}).Start (); }).Start ();

View file

@ -273,10 +273,7 @@ namespace SparkleShare {
public void UpdateContent (string html) public void UpdateContent (string html)
{ {
Thread thread = new Thread (new ThreadStart (delegate { new Thread (() => {
if (html == null)
html = Controller.HTML;
string pixmaps_path = Path.Combine ( string pixmaps_path = Path.Combine (
SparkleLib.SparkleConfig.DefaultConfig.TmpPath, "Pixmaps"); SparkleLib.SparkleConfig.DefaultConfig.TmpPath, "Pixmaps");
@ -310,8 +307,8 @@ namespace SparkleShare {
Dispatcher.BeginInvoke ((Action) delegate { Dispatcher.BeginInvoke ((Action) delegate {
this.spinner.Stop (); this.spinner.Stop ();
this.web_browser.ObjectForScripting = new SparkleScriptingObject (); this.web_browser.ObjectForScripting = new SparkleScriptingObject ();
this.web_browser.NavigateToString (html); this.web_browser.NavigateToString (html);
if (!this.canvas.Children.Contains (this.web_browser)) { if (!this.canvas.Children.Contains (this.web_browser)) {
this.canvas.Children.Add (this.web_browser); this.canvas.Children.Add (this.web_browser);
@ -319,9 +316,8 @@ namespace SparkleShare {
Canvas.SetTop (this.web_browser, 36); Canvas.SetTop (this.web_browser, 36);
} }
}); });
}));
thread.Start (); }).Start ();
} }