Use of KDirWatch

Eike Hein hein at kde.org
Fri Aug 8 15:31:33 UTC 2014


Hi,

many things in Plasma use KDirWatch to keep an eye on changes,
e.g. the theming and look-and-feel systems, and they usually
go through the KDirWatch::self() instance.

The gotcha with using the shared instance is that slots
connected to its signals then have to make sure to discard
notifications about files they don't actually care about but
*others* do, and Plasma code currently isn't rigorous on that.
While the theming code is smart about it, I just spotted a
slot in the look-and-feel code that isn't.

A major source of unexpected notifications can be KDirLister,
which is what powers KDirModel - and so e.g. every instance
of Folder. If you're using Folder, any files created in the
directory it's tracking will currently cause the look-and-
feel system to do work reparsing configuration.

This isn't hard to fix on a case-by-case basis, but means
we should probably at least do an audit to find those cases
since there might be more lurking. Alternatively, we could
decide adopt a practice of using local KDirWatch instances,
or at least partition things a bit more.

Thoughts?


Cheers,
Eike


More information about the Plasma-devel mailing list