Jean-Marc Lasgouttes wrote:
"Abdelrazak" == Abdelrazak Younes <[EMAIL PROTECTED]> writes:

Abdelrazak> The problem here is that the Toc dialog has not been
Abdelrazak> reconstructed (because it comes after in the list of
Abdelrazak> dialogs).

Abdelrazak> This patch should definitely go _before_ 1.5.0; OK?

I understand that we need to fix that before 1.5.0 and that this is
the easiest route, but in general I'd rather avoid to add explicit
tests against LFUNS like this one. (not that I have a better solution
at hand...).

Here is an alternative patch. I don't like it because this means that the Toc dialog will be rebuilt twice. But I'll put it in if you prefer.

Longer term, we probably need to add some new properties to the LFUNs like the new clearSelection one.

Abdel.
Index: LyXView.cpp
===================================================================
--- LyXView.cpp (revision 19003)
+++ LyXView.cpp (working copy)
@@ -163,6 +163,18 @@
 
                connectBuffer(*newBuffer);
 
+               /* FIXME: Rebuild the Toc dialog before the others even if it 
+               will be rebuilt again in the next line. This avoid a crash when
+               other dialogs are rebuilt before the Toc dialog. The reason is
+               that closing a Buffer triggers an update of all opened dialogs
+               when dispatching LFUN_DIALOG_UPDATE (hence the patch).
+               The path is as following:
+                       setBuffer() -> updateBufferDependent() -> 
RestoreButton() -> LFUN
+                       
+               The problem here is that the Toc dialog has not been
+               reconstructed (because it comes after in the list of dialogs). 
*/
+               updateToc();
+
                // Buffer-dependent dialogs should be updated or
                // hidden. This should go here because some dialogs (eg ToC)
                // require bv_->text.
@@ -462,7 +474,7 @@
        }
 
        BOOST_ASSERT(work_area_);
-       string const & layout = work_area_->bufferView().cursor().
+       docstring const & layout = work_area_->bufferView().cursor().
                innerParagraph().layout()->name();
 
        if (layout != current_layout) {

Reply via email to