rgheck schreef:
rgheck wrote:
Vincent van Ravesteijn wrote:

That said, QFileInfo already caches this data. So why wasn't that good enough? Why did Bennett have the problem that required the refresh() calls that lead to the additional filesystem access? I think the answer is that the first time the comparison was made, the file didn't exist, and THAT fact got cached, so that the next time the comparison was made, it returned false, even though the filenames were the same. (This is the odd behavior of QFileInfo that Vincent ran into somewhere else.) So we had to refresh. I think this case is dealt with properly here. If we get nothing back from canonicalFilename(), then we just compare the paths.

Yes, something like this happens indeed. Note further that the caching of QFileInfo only makes sense if you access the same object. In e.g. filetools.cpp:makeAbsPath() we make a new filename object every time, which thus has a new QFileInfo object, which automatically doesn't know about any cached values. This means that if we keep the user defined path in e.g. InsetInclude, we create the absolute path every time when we want to compare this value with the one in theBufferList().

One more idea. Looking back at this thread, you once noted, Vincent, that it's the check of QFileInfo::exists() that accesses the filesystem in the constructor. What if we just take this out? Then QFileInfo's own cache will deal with the makeAbsPath problem for us. Presumably we then have a different problem, but maybe we can deal with it some other way. But surely it's crazy to access the filesystem every time we create a FileName object.
Yes, that looks like a sensible plan, but.. now we have to find out which other problems are introduced.. I don't know whether that will be easy.

What do you mean by the makeAbsPath problem ? The problem is that we are comparing a different FileName object each time, so caching won't help us out here. We should store a FileName object in e.g. InsetInclude before caching will have any significant effect..


So, another patch, just with that change. Does this help?

Richard

I can't test right now, but I wouldn't expect major difference...

Vincent

Reply via email to