kdecore: limit standard directories cache to 10000 entries

this also fixes a strange bug that I originally tought that it's an RPATH
issues but it turns out that this is some kind of mutex-lock issue. to be
more interesting this bug does not occur when the NDEBUG conditionals are
removed or if they are unconditionalized, the first observation leads me to
think that this is compiler bug and the second that it's mutex-lock issue
that is resolved because some code in KDebug and/or QDebug (i've tried with
it too) locks/unlockes/detaches/does some voodoo that overcomes the bug.

in any case it's hard for me to pin-point the problem so if anyone can look
into it that would be great, for now this change will do


Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2015-11-03 06:51:57 +02:00
parent 278289c6ef
commit f2e4e3f486

View file

@ -553,22 +553,13 @@ bool KStandardDirs::exists(const QString &fullPath) const
bool KStandardDirs::KStandardDirsPrivate::exists(const QString &fullPath)
{
Q_UNUSED(max_file_info);
#if 0
if(m_infocache.count() == max_file_info) {
m_infocache.clear();
}
#endif
QFileInfo fileinfo;
if(m_infocache.contains(fullPath)) {
#ifndef NDEBUG
kDebug(180) << "cached exists check on" << fullPath;
#endif
fileinfo = m_infocache.value(fullPath);
} else {
#ifndef NDEBUG
kDebug(180) << "new exists check on" << fullPath;
#endif
fileinfo = QFileInfo(fullPath);
m_infocache.insert(fullPath, fileinfo);
}