mac: Fix rest of memory leak warnings. Closes #552

This commit is contained in:
Hylke Bons 2012-03-01 21:17:49 +00:00
parent f2d6daeda2
commit b19751f61a

View file

@ -41,16 +41,18 @@ namespace SparkleShare {
public SparkleController () : base () public SparkleController () : base ()
{ {
string content_path = using (var a = new NSAutoreleasePool ())
Directory.GetParent (System.AppDomain.CurrentDomain.BaseDirectory).ToString (); {
string content_path =
Directory.GetParent (System.AppDomain.CurrentDomain.BaseDirectory).ToString ();
string app_path = Directory.GetParent (content_path).ToString (); string app_path = Directory.GetParent (content_path).ToString ();
string growl_path = Path.Combine (app_path, "Frameworks", "Growl.framework", "Growl"); string growl_path = Path.Combine (app_path, "Frameworks", "Growl.framework", "Growl");
// Needed for Growl
// Needed for Growl Dlfcn.dlopen (growl_path, 0);
Dlfcn.dlopen (growl_path, 0); NSApplication.Init ();
NSApplication.Init (); }
// Let's use the bundled git first // Let's use the bundled git first
@ -197,17 +199,19 @@ namespace SparkleShare {
public override string EventLogHTML public override string EventLogHTML
{ {
get { get {
string resource_path = NSBundle.MainBundle.ResourcePath; using (var a = new NSAutoreleasePool ()) {
string html_path = Path.Combine (resource_path, "HTML", "event-log.html"); string resource_path = NSBundle.MainBundle.ResourcePath;
string html = File.ReadAllText (html_path); string html_path = Path.Combine (resource_path, "HTML", "event-log.html");
string html = File.ReadAllText (html_path);
string jquery_file_path = Path.Combine (NSBundle.MainBundle.ResourcePath, string jquery_file_path = Path.Combine (NSBundle.MainBundle.ResourcePath,
"HTML", "jquery.js"); "HTML", "jquery.js");
string jquery = File.ReadAllText (jquery_file_path); string jquery = File.ReadAllText (jquery_file_path);
html = html.Replace ("<!-- $jquery -->", jquery); html = html.Replace ("<!-- $jquery -->", jquery);
return html; return html;
}
} }
} }
@ -215,14 +219,17 @@ namespace SparkleShare {
public override string DayEntryHTML public override string DayEntryHTML
{ {
get { get {
string resource_path = NSBundle.MainBundle.ResourcePath; using (var a = new NSAutoreleasePool ())
string html_path = Path.Combine (resource_path, "HTML", "day-entry.html"); {
string resource_path = NSBundle.MainBundle.ResourcePath;
string html_path = Path.Combine (resource_path, "HTML", "day-entry.html");
StreamReader reader = new StreamReader (html_path); StreamReader reader = new StreamReader (html_path);
string html = reader.ReadToEnd (); string html = reader.ReadToEnd ();
reader.Close (); reader.Close ();
return html; return html;
}
} }
} }
@ -230,14 +237,16 @@ namespace SparkleShare {
public override string EventEntryHTML public override string EventEntryHTML
{ {
get { get {
string resource_path = NSBundle.MainBundle.ResourcePath; using (var a = new NSAutoreleasePool ()) {
string html_path = Path.Combine (resource_path, "HTML", "event-entry.html"); string resource_path = NSBundle.MainBundle.ResourcePath;
string html_path = Path.Combine (resource_path, "HTML", "event-entry.html");
StreamReader reader = new StreamReader (html_path); StreamReader reader = new StreamReader (html_path);
string html = reader.ReadToEnd (); string html = reader.ReadToEnd ();
reader.Close (); reader.Close ();
return html; return html;
}
} }
} }