On 04/06/12 18:22, Richard Heck wrote:
The problem turns out to be that the paragraph we are redrawing here references a non-existent Layout. This is because the copy_params() routine in FindAndReplace.cpp, although it MAKES a new DocumentClass, it never APPLIES this new DocumentClass to its Buffer. So the paragraphs in that Buffer still refer to the Layouts in the OLD DocumentClass. Which, in the new code, gets garbage collected.

Ops, nice catch! Sorry, for me this document class mangling is quite obscure magic, I just copied some bits from here and there, and when it seemed to work, I never touched it again :-).

I'll sort this out. I've attached a patch that seems to work, but something more elegant is probably needed.

At least, it doesn't crash now. Though, I have to check how it behaves when searching in documents with custom languages (from a quick check it seems ok).

Do u mind explaining what does this code do ?

+void BufferView::makeDocumentClass()
+{
+       DocumentClassConstPtr olddc = buffer_.params().documentClassPtr();
+       buffer_.params().makeDocumentClass();
+       updateDocumentClass(olddc);
+}

(can be useful to put in BufferView.h)

Thanks,

    T.

Reply via email to