Richard Heck wrote: > On 10/29/2014 05:43 PM, Georg Baum wrote: >> >> Maybe the cloning does not work correctly, so deleting the clone does >> actually delwte parts of the static buffer? > > Hmm. That may be. I'm not sure if we copy absolutely everything over. > And the Buffer object > is so, so big....
That was a wrong guess. The cloning works, but setDocumentClass() causes the old document class to be deleted, and this invalidates the layout pointers in the paragraphs of the buffer (actually there is only one paragraph). You usually don't notice the problem, because it is quite unlikely that the just freed memory of the deleted document class is immediately reused for something else, and therefore there is still a valid layout data structure at the old location in memory. However, especially if you paste huge amounts of data, this might be different. I fixed the problem in 5deaaa3b137c, and I propose to also backport this to branch. OK? Georg