Changing time format doesn't update clock

Bug #548571 reported by Arisian
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
FreeGuide-TV
Fix Released
Low
Unassigned

Bug Description

Changing the time format in Tools/Options/Horizontal Viewer from 24 to 12 hour does not update the time panel correctly, leaving the time panel with 24hr time (13:00, 14:00, etc) marks but programs are shown with 12hr times (1:00 PM, 2:00 PM, etc).

Revision history for this message
Arisian (mmclagan) wrote :
Revision history for this message
Arisian (mmclagan) wrote :

The flow of the current code looks something like this:

The initial HorizontalViewer is created with a config object loaded from the prefs.xml (I've no idea where this happens, btw, it's some sort of magic). The HorizontalViewer, as part of it's initialization, creates a TimePanel object passing it a reference to the config stored in the HorizontalViewer. This reference is stored locally by TimePanel as an instance variable, config.

At some point in the process, the user tries to reconfigure the HorizontalViewer via the Tools/Options menu, making changes and saving them. When the ConfigureUIController is created, it creates a local copy of the HorizontalViewer config using the clone() method. When the ConfigureUIController is closed, the save method updates the config instance variable then stores it in "parent.config". This places a reference to the new, cloned config into the "parent" which happens to be the original HorizontalViewer object. This reduces the reference count to the original config, which would normally be garbage collected and disposed of EXCEPT that TimePanel is maintaining a reference to this OLD, ORIGINAL config object in it's own instance variable.

Each time these JPanels are repainted, the TimePanel uses the original, load time config object while the drawProgrammes method is using the current config object stored within the HorizontalViewer object.

Ergo, you can't ever change the time format of the TimePanel without making a change, exiting FreeGuide and restarting.

Revision history for this message
Arisian (mmclagan) wrote :

The attached patch fixes the problem (without renaming parent to viewer). The patch relies on other patches I've put out today, so it may fail if applied out of order or without a previous patch applied.

I added a few "FIXME" comments. Feel free to keep or discard them as appropriate.

Changed in freeguide-tv:
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
Andy Balaam (mail-artificialworlds) wrote :

Thanks for the fix! Committed minus a couple of bits that appeared to be left over from the previous versions.

Changed in freeguide-tv:
status: Confirmed → Fix Committed
Changed in freeguide-tv:
milestone: none → 0.11
Changed in freeguide-tv:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.