KDirWatch problem/bug

Josef Weidendorfer Josef.Weidendorfer at gmx.de
Sat Feb 14 19:52:52 GMT 2004


Am Saturday 14 February 2004 15:48 schrieb Jeroen Wijnhout:
> If a Kate::Document is closed via closeURL() (the proper way), the file is
> removed from the KDirWatch. However if you close it by deleting the
> Kate::Document, the file isn't removed from the KDirWatch. Then if you open
> the file again, the file is added again to the KDirWatch list. It is being
> watched twice now (2 clients).

Good catch!

> However, if you look at the debug info it seems that the file was being
> watched by the same _client_ twice. Doesn't that mean that if this client
> requests to remove the file from KDirWatch that is really should do that,
> remove it. Now it doens't remove it if e->m_clients.count() != 0. However
> it _should_ remove it when all the clients are really one and the same
> client, or am I completely wrong?

Obviously there is *no* bug in the ref counting in KDirWatch. The question
is if refcounting per KDirWatch object per file is overkill, and not needed in 
practice. If yes, we could get rid of the count, solving this way symptoms of 
the bug in Kate.
But I tend to say: Don't change KDirWatch, but fix the bug in the kate part, 
i.e. remove file watching in the destructor of Kate::Document.

We shouldn't change semantic of a kdelibs class (KDirWatch) in minor releases 
of KDE. The problem here perhaps is that the documentation of the semantic of 
KDirWatch::remove is lacking details (we should add them).

Josef




More information about the kde-core-devel mailing list