Bo Peng wrote:
To reproduce: Start LyX create two new buffers, save the second one
(the file name on the tab is not
updated until a buffer change, but i think this was discussed
earlier). after that click on the tab
for the first new file. you will get the assert.
i took a short look at it and found that the code
Can not reproduce it here (Linux). Could you please elaborate?
Bo
A more precise description of the problem (remember: it is necessary to save the new buffer before
clicking on the tab of the first one):
through the click on the tab the following method is called:
void GuiView::currentTabChanged (int index)
{
std::map<int, FuncRequest>::const_iterator it = d.funcmap.find(index);
if (it != d.funcmap.end())
activated(it->second);
}
activated(...) hands the FuncRequest object it->second through some other methods to
LyXFunc::dispatch, where the object it->second is then called cmd. All subsequent function calls in
this chain have the argument defined as const FuncRequest&, thus this object is never copied - cmd
in LyXFunc::dispatch effectively references it->second.
Now i guess the call
lyx_view_->setBuffer(theBufferList().getBuffer(argument));
somehow invalidates the const_iterator it in GuiView::currentTabChanged() and thus the variable cmd.
All i see is that after this call cmd.action is some big negative integer. I did not go deeper
into that code.
Then, at the end of the method LyXFunc::dispatch the code
lyxaction.funcHasFlag(cmd.action, LyXAction::NoBuffer)
uses cmd.action again - which now is invalid and thus there is no corresponding lfun found. this
generates a error message at the command window and triggers the BOOST_ASSERT.
i've attached a workaround that does not use cmd.action but the local variable action (which already
exists). maybe that's enough, but it could also be that that hidden change of cmd has some other
side effects.
Bernhard
PS: Maybe the problem is compiler specific or not present in another version of the std template
library.
Index: lyxfunc.C
===================================================================
--- lyxfunc.C (revision 16872)
+++ lyxfunc.C (working copy)
@@ -1760,8 +1760,8 @@
// if we executed a mutating lfun, mark the buffer as
dirty
if (flag.enabled()
- && !lyxaction.funcHasFlag(cmd.action,
LyXAction::NoBuffer)
- && !lyxaction.funcHasFlag(cmd.action,
LyXAction::ReadOnly))
+ && !lyxaction.funcHasFlag(action,
LyXAction::NoBuffer)
+ && !lyxaction.funcHasFlag(action,
LyXAction::ReadOnly))
view()->buffer()->markDirty();
if (view()->cursor().inTexted()) {