On 23/03/2009 19:08, rgheck wrote:
Abdelrazak Younes wrote:
rgheck wrote:
Abdelrazak Younes wrote:
rgheck wrote:
Abdelrazak Younes wrote:
Helge Hafting wrote:
I wonder if this loadifneeded stuff is too complicated?
How about getting rid of loadifneeded, and simply load everything unconditionally? (And disallow closing of needed files as well, only close the view if the user tries.)

That's already exactly what we do :-)

I think the check is needed because e.g. the master buffer could be saved under a different name. Are there other ways buffers could vanish?

I don't think so. But I think we are not focusing on the right issue here. loadIfneeded() just verify that all child documents are properly loaded. This in itself should not be time consuming at all. If we have a problem with FileName comparison, we should maintain a Buffer pointer inside the InsetInclude. This way, the test would only be to check this pointer is null or not.

But there is the way I mentioned, yes? If you save the master buffer under a different name, then the master buffer isn't loaded any more.

But the child documents won't (or shouldn't) be closed because of a master name change. The master buffer will be the same Buffer object IIRC, there would be no object destruction and construction, so the child document should stay the same.

But my point is that the cached Buffer * would now point at the wrong buffer, i.e., not at one in which the child's master document was loaded.

I don't follow you, I proposed that the InsetInclude inset caches the child Buffer pointer. This one should not change, even if you rename the master Buffer. Keep in mind that one Buffer can be the child of multiple master Buffers.

In that case, loadIfNeeded() would reload the old file. We would need to invalidate the cached Buffer *.

No, the child document won't have to be reloaded because it won't be closed at all. Even the master Buffer won't be closed with a file rename. I am not sure we talk about the same things... :-)

Abdel.

Reply via email to