Georg Baum wrote:
Abdelrazak Younes wrote:

Georg Baum wrote:
Abdelrazak Younes wrote:

Index: frontends/LyXView.C
===================================================================
--- frontends/LyXView.C        (revision 14813)
+++ frontends/LyXView.C        (working copy)
@@ -139,22 +139,19 @@
work_area_->bufferView().setBuffer(b); - if (work_area_->bufferView().buffer())
-        {
+        if (work_area_->bufferView().buffer()) {
                 // Buffer-dependent dialogs should be updated or
                 // hidden. This should go here because some dialogs (eg
ToC)
                 // require bv_->text.
                 getDialogs().updateBufferDependent(true);
+                connectBuffer(*work_area_->bufferView().buffer());
+                setLayout(work_area_->bufferView().firstLayout());
         }
updateMenubar();
         updateToolbars();
         updateLayoutChoice();
         updateWindowTitle();
-        if (b) {
-                connectBuffer(*b);
-                setLayout(work_area_->bufferView().firstLayout());
-        }
         redrawWorkArea();
 }
This looks wrong (the rest looks OK). Do you know that b !=
work_area_->bufferView().buffer() is possible even after a
work_area_->bufferView().setBuffer(b)?
This was indeed the case before my patch but look also at my
BufferView_pimp change.

They do only change the behaviour if quitting == true.

This plus my older changes to BufferView::setBuffer(), please read that method and I think you will understand.

b !=
work_area_->bufferView().buffer() is still possible.

No, they may differ only if b == 0 which means that we are killing the buffer.


BTW, it would be nice
if you could do your diffs with function names (-p argument of diff).

I'll try to read the TortoiseSVN doc to do that.


I've tested this patch with a lot of buffer switching and deletion.

It may work, but I still think that the logic above is wrong. You are going
to call connectBuffer and setLayout with an already connected buffer when b
== 0.

No, when b==0, BufferView::setBuffer() will switch to the first available buffer in the bufferlist.


That may do no harm, but is AFAIK not necessary, and makes the code
harder to understand.

I agree that it is hard to understand and the main reason is that setBuffer(0) for killing a buffer is not a good API. I'll try to clean up that when I get some time.

Is that any clearer?

Abdel.

Reply via email to