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

@ -40,6 +40,8 @@ namespace SparkleShare {
public SparkleController () : base () public SparkleController () : base ()
{
using (var a = new NSAutoreleasePool ())
{ {
string content_path = string content_path =
Directory.GetParent (System.AppDomain.CurrentDomain.BaseDirectory).ToString (); Directory.GetParent (System.AppDomain.CurrentDomain.BaseDirectory).ToString ();
@ -47,10 +49,10 @@ namespace SparkleShare {
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,6 +199,7 @@ namespace SparkleShare {
public override string EventLogHTML public override string EventLogHTML
{ {
get { get {
using (var a = new NSAutoreleasePool ()) {
string resource_path = NSBundle.MainBundle.ResourcePath; string resource_path = NSBundle.MainBundle.ResourcePath;
string html_path = Path.Combine (resource_path, "HTML", "event-log.html"); string html_path = Path.Combine (resource_path, "HTML", "event-log.html");
string html = File.ReadAllText (html_path); string html = File.ReadAllText (html_path);
@ -210,11 +213,14 @@ namespace SparkleShare {
return html; return html;
} }
} }
}
public override string DayEntryHTML public override string DayEntryHTML
{ {
get { get {
using (var a = new NSAutoreleasePool ())
{
string resource_path = NSBundle.MainBundle.ResourcePath; string resource_path = NSBundle.MainBundle.ResourcePath;
string html_path = Path.Combine (resource_path, "HTML", "day-entry.html"); string html_path = Path.Combine (resource_path, "HTML", "day-entry.html");
@ -225,11 +231,13 @@ namespace SparkleShare {
return html; return html;
} }
} }
}
public override string EventEntryHTML public override string EventEntryHTML
{ {
get { get {
using (var a = new NSAutoreleasePool ()) {
string resource_path = NSBundle.MainBundle.ResourcePath; string resource_path = NSBundle.MainBundle.ResourcePath;
string html_path = Path.Combine (resource_path, "HTML", "event-entry.html"); string html_path = Path.Combine (resource_path, "HTML", "event-entry.html");
@ -240,6 +248,7 @@ namespace SparkleShare {
return html; return html;
} }
} }
}
public override void OpenFile (string url) public override void OpenFile (string url)