Bug Fixes in KDE Base
Fully clear cache metadata in clearInternal().
KSharedDataCache uses the clearInternal() method to reset the cache, which is used if
corruption is detected, and when directed through KSharedDataCache::clear(). For whatever
reason I thought that simply setting the "first page" pointer for each possible index
entry would be sufficient, but that is not the case at all, as various methods which go
through the cache entries also check things such as the use count, last access time, etc.
Assuming no other errors (:-/) this should be the cause of bug 260309. (The
exact sequence would be a KSharedDataCache user runs ::clear(), later adds some
entries that invoke removeUsedPages(), and removeUsedPages() goes through *all*
index entries, including ones that appear to be in use since their use count is
>0, but their first page is still invalid). Easiest way to invoke this bug I've
found is to simply run "plasmoidviewer clock" at a konsole.
While reviewing code I also added a comment clarifying the usage of a page
variable as an index entry, and changed the index entry comparison functions to
look for any invalid page instead of checking for -1, as it takes me 5 minutes
every single time I review removeUsedPages to prove that -1 is the only
possible value <0. These changes will not be backported to KDE Platform 4.6.