On 17. nov. 2011 00:32, Richard Heck wrote:
Current trunk and branch crash when previewing or autosaving certain
document sets involving a single file that is included multiple times.
One easy example has the structure:
Master --> Child 1
Master --> Child 2 --> Child 1
The problem is that the Child 1 Buffer is deleted multiple times,
because the logic in ~Buffer cannot make use of the BufferList to detect
whether a Buffer has already been released.
The first attached patch addresses this issue by keeping a list of the
cloned Buffers in the master Buffer of the cloned set. This can then be
checked as we proceed through the deletion process.
Isn't this a case where reference counting might work well?
In this case, "Master" and "Child2" ise used one time each,
while "child1" is used twice.
Upon deleting, reduce the reference count. If it goes to 0,
delete the buffer. If it does not - just keep it with the
reduced count.
This works well for the linux kernel, at least. :-)
Helge Hafting