logger: Fix possible sharing violation on log file
This commit is contained in:
parent
e0a2e2a0b6
commit
0a847be8bb
|
@ -24,10 +24,8 @@ using Sparkles;
|
|||
|
||||
namespace SparkleShare
|
||||
{
|
||||
|
||||
public class UserInterface
|
||||
{
|
||||
|
||||
public static string AssetsPath = InstallationInfo.Directory;
|
||||
|
||||
public StatusIcon StatusIcon;
|
||||
|
@ -53,7 +51,8 @@ namespace SparkleShare
|
|||
application.Register (null);
|
||||
application.Activated += ApplicationActivatedDelegate;
|
||||
|
||||
IconTheme.Default.AppendSearchPath (Path.Combine (UserInterface.AssetsPath, "icons"));
|
||||
if (IconTheme.Default != null)
|
||||
IconTheme.Default.AppendSearchPath (Path.Combine (UserInterface.AssetsPath, "icons"));
|
||||
|
||||
var label = new Label ();
|
||||
Gdk.Color color = UserInterfaceHelpers.RGBAToColor (label.StyleContext.GetColor (StateFlags.Insensitive));
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace Sparkles {
|
|||
|
||||
public static class Logger {
|
||||
|
||||
static StreamWriter log_writer = File.AppendText (Configuration.DefaultConfiguration.LogFilePath);
|
||||
static StreamWriter log_writer = File.CreateText (Configuration.DefaultConfiguration.LogFilePath);
|
||||
static object log_writer_lock = new object ();
|
||||
|
||||
|
||||
|
@ -63,6 +63,9 @@ namespace Sparkles {
|
|||
|
||||
public static void WriteCrashReport (Exception e)
|
||||
{
|
||||
if (log_writer != null)
|
||||
log_writer.Close ();
|
||||
|
||||
string home_path = Environment.GetFolderPath (Environment.SpecialFolder.Personal);
|
||||
|
||||
if (InstallationInfo.OperatingSystem == OS.Windows)
|
||||
|
|
Loading…
Reference in a new issue