[mythtv] BUG: read of freed memory in themedmenu.cpp
Geoffrey Hausheer
ou401cru02 at sneakemail.com
Wed Sep 17 10:29:20 EDT 2003
Another valgrind find...
When navigating the menu, when pressing 'Enter' valgrind reports a read
of uninitialized memory at:
update(lastbutton->posRect);
in keyPressEvent
This happens because the 'Enter' results in a
'handleAction(activebutton->action)' which resets all the buttons on the
screen.
The patch below seems to fix the problem, but if there is any case where
handleAction doesn't result in rebuilding the screen, then perhaps it
sn't quite right (seem sto work well for me so far though). I think the
actual memory reset happens in parseMenu, which isn't always called from
handleAction, but the patch doesn't seem to affect the other cases
either, so I think it is OK. Basically, I just invalidate lastButtun
whenever the user hits 'Enter'.
Index: themedmenu.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmyth/themedmenu.cpp,v
retrieving revision 1.55
diff -u -r1.55 themedmenu.cpp
--- themedmenu.cpp 5 Sep 2003 06:20:48 -0000 1.55
+++ themedmenu.cpp 17 Sep 2003 14:01:27 -0000
@@ -1651,6 +1651,7 @@
case Key_Space:
{
handleAction(activebutton->action);
+ lastbutton = NULL;
handled = true;
break;
}
@@ -1695,7 +1696,8 @@
lcddev->switchToMenu(&menuItems, titleText);
}
update(watermarkRect);
- update(lastbutton->posRect);
+ if (lastbutton)
+ update(lastbutton->posRect);
update(activebutton->posRect);
}
else
.Geoff
More information about the mythtv-dev
mailing list