Tag bug?



Hi all,

My apologies if this is not the correct place to report bugs, please direct
me at the right place if I've found the wrong one.

I'm not entirely sure how I created this problem, but I'll describe the
problem nevertheless.

As soon as I open up f-spot I get the following traceback (snipped a
little):

Unhandled Exception: System.NullReferenceException: Object reference not set
to an instance of an object
in [0x005ce] (at .../IconView.cs:727) IconView:DrawCell (Int32
thumbnail_num, Rectangle area)
in [0x000d6] (at .../IconView.cs:792) IconView:DrawAllCells (Rectangle area)
in [0x0002a] (at .../IconView.cs:1089) IconView:OnExposeEvent
(Gdk.EventExpose args)
... etc ...


I managed to track this down to a null Tag object somehow being passed up to
the DrawCell function. I hacked around this with the following patchlet:



--- IconView.cs~        2005-06-09 00:19:12.000000000 +0200
+++ IconView.cs 2005-06-09 00:19:12.000000000 +0200
@@ -722,6 +722,7 @@
                        tag_bounds.Height = tag_icon_size;
 
                        foreach (Tag t in tags) {
+                               if (t == null) continue;
                                Pixbuf icon = null;
                                if (t.Category.Icon == null) {
                                        if (t.Icon == null)




I noticed a similar problem occurring when trying to remove a tag, the
following hack solved that:


--- PhotoTagMenu.cs~    2005-06-09 00:20:24.000000000 +0200
+++ PhotoTagMenu.cs     2005-06-09 00:20:24.000000000 +0200
@@ -55,7 +55,7 @@
                if (photos != null) {
                        foreach (Photo p in photos) {
                                foreach (Tag t in p.Tags) {
-                                       if (tag != null && !hash.Contains (t.Id)) {
+                                       if (t != null && !hash.Contains (t.Id)) {
                                                hash.Add (t.Id, t);
                                        }
                                }



Now I'm sure that this is probably just putting a bandage over the real
problem, but unfortunately I don't have the C# acumen (nor the time, really)
to delve too much deeper :) There is at least one problem with the first
patchlet -- tag icons are not properly centered on the photo :)

Out of interest I put together some code to inspect the tables in the
photos.db, and I noticed that my photo_tags table contained entries which
had a valid photo, but referenced non-existant tags. I did create a few tags
and delete them soon before F-Spot first crashed with the problem, and the
ID's referenced in photo_tags would be in the sort of range of ID's that
those tags would've had.

If it would help I can try to recreate this bug, or supply my photos.db or
any other information needed for debugging.

Russell
-- 
echo http://russell.rucus.net/spam/ | sed 's,t/.*,t,;P;s,.*//,,;s,\.,@,;'



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]