On 10/03/2017 03:10 PM, Scott Kostyshak wrote: > Can anyone else reproduce? > > 1. Open Additional.lyx in LyX > 2. Go to a URL inset (e.g. search for "www.literateprogramming.com") > 3. Highlight the inside of the inset (e.g. ctrl-a). > 4. Change that URL externally (e.g. add a letter somewhere) > 5. Click "Reload" in LyX's blue banner notification. > 6. Click "Reload" in the dialog that pops up. > > I get a crash. > > I can reproduce on 2.3.x and master. I can't reproduce in splash.lyx
I can reproduce, and without the highlighting and such. There's are some InsetInfos in this document, and it seems to be the third one that is triggering the crash: \begin_inset Info type "menu" arg "dialog-show document" \end_inset The crucial thing here seems to be that it's a "menu" inset. That triggers a menu search, which calls getStatus, which ends up accessing the Cursor, which is now out of date. So we end up here: Paragraph & CursorSlice::paragraph() const { return text()->getPar(pit_); } and the pit_ is at this point invalid. So it does depend upon where the cursor was---if I put it at the beginning of the document, I don't get the crash---which is maybe why it seemed to matter about the highlighting. The attached fixes it for me, and may be a good idea anyway. Richard ===== (gdb) bt #0 0x00007ffff5859610 in std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::size() const () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #1 0x0000000000dbb06c in lyx::Paragraph::size (this=0x37dfd90) at /home/scott/lyxbuilds/master/repo/src/Paragraph.cpp:3825 #2 0x0000000000ebdcad in lyx::lookupChangeType (dit=..., outer=true) at /home/scott/lyxbuilds/master/repo/src/BufferView.cpp:1027 #3 0x0000000000ebdf38 in lyx::BufferView::getStatus (this=0x354b110, cmd=..., flag=...) at /home/scott/lyxbuilds/master/repo/src/BufferView.cpp:1054 #4 0x00000000011ee9a1 in lyx::frontend::GuiApplication::getStatus (this=0x202a410, cmd=...) at /home/scott/lyxbuilds/master/repo/src/frontends/qt4/GuiApplication.cpp:1181 #5 0x0000000000f32a81 in lyx::getStatus (action=...) at /home/scott/lyxbuilds/master/repo/src/LyX.cpp:1455 #6 0x00000000013e1857 in lyx::frontend::(anonymous namespace)::MenuDefinition::addWithStatusCheck (this=0x31e8990, i=...) at /home/scott/lyxbuilds/master/repo/src/frontends/qt4/Menus.cpp:407 #7 0x00000000013f40b1 in lyx::frontend::Menus::Impl::expand (this=0x20bde20, frommenu=..., tomenu=..., bv=0x0) at /home/scott/lyxbuilds/master/repo/src/frontends/qt4/Menus.cpp:2312 #8 0x00000000013f3fe3 in lyx::frontend::Menus::Impl::expand (this=0x20bde20, frommenu=..., tomenu=..., bv=0x0) at /home/scott/lyxbuilds/master/repo/src/frontends/qt4/Menus.cpp:2299 #9 0x00000000013f3fe3 in lyx::frontend::Menus::Impl::expand (this=0x20bde20, frommenu=..., tomenu=..., bv=0x0) at /home/scott/lyxbuilds/master/repo/src/frontends/qt4/Menus.cpp:2299 #10 0x00000000013f4daa in lyx::frontend::Menus::searchMenu (this=0x206f6d0, func=..., names=...) at /home/scott/lyxbuilds/master/repo/src/frontends/qt4/Menus.cpp:2434 #11 0x00000000011f961e in lyx::frontend::GuiApplication::searchMenu (this=0x202a410, func=..., names=...) at /home/scott/lyxbuilds/master/repo/src/frontends/qt4/GuiApplication.cpp:2918 #12 0x000000000113d241 in lyx::InsetInfo::updateInfo (this=0x343c3f0) at /home/scott/lyxbuilds/master/repo/src/insets/InsetInfo.cpp:379 #13 0x000000000113b6fc in lyx::InsetInfo::read (this=0x343c3f0, lex=...) at /home/scott/lyxbuilds/master/repo/src/insets/InsetInfo.cpp:150 #14 0x0000000000ed7db0 in lyx::readInset (lex=..., buf=0x2c38960) at /home/scott/lyxbuilds/master/repo/src/factory.cpp:685 #15 0x0000000000d549b8 in lyx::Text::readParToken (this=0x2d95728, par=..., lex=..., token="\\begin_inset", font=..., change=..., errorList=...) at /home/scott/lyxbuilds/master/repo/src/Text.cpp:414 #16 0x0000000000d569b5 in lyx::Text::readParagraph (this=0x2d95728, par=..., lex=..., errorList=...) at /home/scott/lyxbuilds/master/repo/src/Text.cpp:568 #17 0x0000000000d5cad3 in lyx::Text::read (this=0x2d95728, lex=..., errorList=..., insetPtr=0x2d95710) at /home/scott/lyxbuilds/master/repo/src/Text.cpp:1867 #18 0x0000000000e35caa in lyx::Buffer::readDocument (this=0x2c38960, lex=...) at /home/scott/lyxbuilds/master/repo/src/Buffer.cpp:1068 #19 0x0000000000e36db8 in lyx::Buffer::readFile (this=0x2c38960, fn=...) at /home/scott/lyxbuilds/master/repo/src/Buffer.cpp:1192 #20 0x0000000000e50d2d in lyx::Buffer::loadThisLyXFile (this=0x2c38960, fn=...) at /home/scott/lyxbuilds/master/repo/src/Buffer.cpp:4665 #21 0x0000000000e50d07 in lyx::Buffer::loadLyXFile (this=0x2c38960) at /home/scott/lyxbuilds/master/repo/src/Buffer.cpp:4659 #22 0x0000000000e53391 in lyx::Buffer::reload (this=0x2c38960) at /home/scott/lyxbuilds/master/repo/src/Buffer.cpp:5169
diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 1a1ca54..b0d7c86 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -3173,6 +3173,7 @@ static bool ensureBufferClean(Buffer * buffer) bool GuiView::reloadBuffer(Buffer & buf) { + currentBufferView()->cursor().reset(); Buffer::ReadStatus status = buf.reload(); return status == Buffer::ReadSuccess; }