Abdelrazak Younes wrote:
Abdelrazak Younes wrote:
Richard Heck wrote:
Idea for fix: Since the buffer_func.cpp version of loadLyXFile() is called from LyXView::loadLyXFile(), anyway, all the child doc stuff could be moved there. But I don't know this code terribly well. Abdel?
Very good analysis Richard! The solution is to use the LFUN instead of using loadLyXFile from buffer_funcs.cpp. This should fix the problem.
Does this patch (on top of the other) fixes the problem?
I'm checking this now, but I think it will have the problem I mentioned in the last email: We'll end up switching open buffers. Also needed a small change...

rh
------------------------------------------------------------------------

Index: InsetInclude.cpp
===================================================================
--- InsetInclude.cpp    (revision 18780)
+++ InsetInclude.cpp    (working copy)
@@ -26,6 +26,7 @@
 #include "gettext.h"
 #include "LaTeXFeatures.h"
 #include "LyX.h"
+#include "LyXFunc.h"
 #include "LyXRC.h"
 #include "Lexer.h"
 #include "MetricsInfo.h"
@@ -400,12 +401,10 @@
                // the readonly flag can/will be wrong, not anymore I think.
                if (!fs::exists(included_file.toFilesystemEncoding()))
                        return false;
-               buf = theBufferList().newBuffer(included_file.absFilename());
-               if (!loadLyXFile(buf, included_file)) {
-                       //close the buffer we just opened
-                       theBufferList().close(buf, false);
-                       return false;
-               }
What follows has to be const_cast<Buffer &>(buffer).dispatch().
+               dispatch(FuncRequest(LFUN_BUFFER_CHILD_OPEN,
+                       included_file.absFilename()));
+               buf = theBufferList().getBuffer(included_file.absFilename());
+               return buf;
        }
        buf->setParentName(parentFilename(buffer));
        return true;


--
==================================================================
Richard G Heck, Jr
Professor of Philosophy
Brown University
http://frege.brown.edu/heck/
==================================================================
Get my public key from http://sks.keyserver.penguin.de
Hash: 0x1DE91F1E66FFBDEC
Learn how to sign your email using Thunderbird and GnuPG at:
http://dudu.dyn.2-h.org/nist/gpg-enigmail-howto

Reply via email to