Skip to content

Commit

Permalink
possible fix for Disk I/O exception on sleep
Browse files Browse the repository at this point in the history
  • Loading branch information
sepich committed Aug 21, 2015
1 parent bd7fb0d commit 0ee6029
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
1 change: 1 addition & 0 deletions SynNotes/Form.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1896,6 +1896,7 @@ public static class Glob {
public const string Inherit = "Inherit";
public const string Changed = "changed";
public const string Saved = "saved";
public const string Unsaved = "error of saving";
public static readonly DateTime Epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); //unixtime start
}
}
27 changes: 16 additions & 11 deletions SynNotes/Note.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,19 +126,24 @@ public void Save() {
f.Text = t;
}
//save text
using (SQLiteTransaction tr = f.sql.BeginTransaction()) {
using (SQLiteCommand cmd = new SQLiteCommand(f.sql)) {
cmd.CommandText = "UPDATE notes SET modifydate=?, title=?, content=?, topline=? WHERE id=?";
cmd.Parameters.AddWithValue(null, Item.ModifyDate);
cmd.Parameters.AddWithValue(null, Item.Name);
cmd.Parameters.AddWithValue(null, f.scEdit.Text);
cmd.Parameters.AddWithValue(null, Item.TopLine);
cmd.Parameters.AddWithValue(null, Item.Id);
cmd.ExecuteNonQuery();
try {
using (SQLiteTransaction tr = f.sql.BeginTransaction()) {
using (SQLiteCommand cmd = new SQLiteCommand(f.sql)) {
cmd.CommandText = "UPDATE notes SET modifydate=?, title=?, content=?, topline=? WHERE id=?";
cmd.Parameters.AddWithValue(null, Item.ModifyDate);
cmd.Parameters.AddWithValue(null, Item.Name);
cmd.Parameters.AddWithValue(null, f.scEdit.Text);
cmd.Parameters.AddWithValue(null, Item.TopLine);
cmd.Parameters.AddWithValue(null, Item.Id);
cmd.ExecuteNonQuery();
}
tr.Commit();
}
tr.Commit();
f.scEdit.Modified = false;
}
catch {
f.statusText.Text = Glob.Unsaved;
}
f.scEdit.Modified = false;
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion SynNotes/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("15.02.21.0")]
[assembly: AssemblyFileVersion("15.04.30.0")]
[assembly: NeutralResourcesLanguageAttribute("en-US")]

0 comments on commit 0ee6029

Please sign in to comment.