[f-spot] Fixes for:
- From: Stephane Delcroix <sdelcroix src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [f-spot] Fixes for:
- Date: Fri, 7 Aug 2009 19:08:02 +0000 (UTC)
commit 6ba9525dbb2dd26d404835127f60f4534aa74f0b
Author: Mike Gemünde <mike gemuende de>
Date: Sat Jul 25 11:31:53 2009 +0200
Fixes for:
* TimeAdaptor didn't take care about years, which are completely removed in database,
instead it updated minyear just to lesser values and maxyear to greater ones. This lead
to a crash if all photos of a year (minyear or maxyear) are removed AND the current query
is empty after that.
* Setting the years dictionary and updating minyear maxyear in a thread after that is unsafe.
Update is now done in Gtk-Thread to not lead to an inconsitant state.
src/TimeAdaptor.cs | 27 ++++++++++++++++++---------
1 files changed, 18 insertions(+), 9 deletions(-)
---
diff --git a/src/TimeAdaptor.cs b/src/TimeAdaptor.cs
index 77c86de..3dcb3f5 100644
--- a/src/TimeAdaptor.cs
+++ b/src/TimeAdaptor.cs
@@ -168,16 +168,25 @@ namespace FSpot {
void DoReload ()
{
Thread.Sleep (200);
- years = query.Store.PhotosPerMonth ();
- foreach (int year in years.Keys) {
- startyear = Math.Min (year,startyear);
- endyear = Math.Max (year,endyear);
+ Dictionary <int, int[]> years_tmp = query.Store.PhotosPerMonth ();
+ int startyear_tmp = Int32.MaxValue;
+ int endyear_tmp = Int32.MinValue;
+
+ foreach (int year in years_tmp.Keys) {
+ startyear_tmp = Math.Min (year, startyear_tmp);
+ endyear_tmp = Math.Max (year, endyear_tmp);
}
- if (Changed != null)
- Gtk.Application.Invoke(delegate {
- if (Changed != null)
- Changed (this);
- });
+
+ Gtk.Application.Invoke(delegate {
+
+ years = years_tmp;
+ startyear = startyear_tmp;
+ endyear = endyear_tmp;
+
+ if (Changed != null)
+ Changed (this);
+ });
+
Log.DebugTimerPrint (timer, "TimeAdaptor REAL Reload took {0}");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]