Opened 15 years ago
Closed 15 years ago
#5830 closed patch (fixed)
TV Guide StartChannel logic error
Reported by: | Owned by: | danielk | |
---|---|---|---|
Priority: | minor | Milestone: | 0.22 |
Component: | mythtv | Version: | head |
Severity: | low | Keywords: | |
Cc: | Ticket locked: | no |
Description
There is a logic error in the code to determine the startchannel in guidegrid.cpp introduced sometime in the last few months.
In the routine GuideGrid::fillChannelInfos there is the following code:
if (gotostartchannel)
m_currentStartChannel = FindChannel?(startChanID, startChanNum);
m_currentStartChannel = max((uint)0, m_currentStartChannel);
FindChannel? returns -1 if it is unable to match the startChanID with a channel and the max function is intended to make m_currentStartChannel=0 in this case. However, m_currentStartChannel is uint, so it never gets assigned -1, but instead the maximum int value. As such the "max" function picks this instead of 0 for the startchannel. This causes GuideGrid::fillProgramRowInfos to return before updating the program information.
The code should be something like
int ch;
if (gotostartchannel)
ch = FindChannel?(startChanID, startChanNum);
m_currentStartChannel = max(0, ch);
This bug affects the channel group patch attached to Ticket #199 for which I will attached an update for SVN in the next day or so. Without this patch, when switching channel groups, the guide display doesn`t update for the newly selected group until one presses pageup or pagedown.
By the way, the proposed code above I have tested with SVN and it is working fine. I can add a patch for the above code if needed, if this solution method is acceptable.