On 28/10/2008 00:14, Enrico Forestieri wrote:
On Mon, Oct 27, 2008 at 07:08:26PM +0100, Abdelrazak Younes wrote:
On 27/10/2008 12:58, rgheck wrote:
Tommaso Cucinotta wrote:
Pavel Sanda ha scritto:
i have put it in. anyway at first try:
1. load math manual
2. search math exrp E/F
3. search
4. kaboom
I have tracked down the problem to a much simpler example:
1. New document
2. Enter any text containing a double quote character (")
3. AdvSearch for whatever
4. Assertion fails
With a debugger, I could verify that the InsetQuote object points to
a NULL buffer, so the start of the LyX death is this segment:
InsetQuotes.cpp:183
docstring InsetQuotes::displayString() const
{
Language const * loclang = buffer().params().language;
(this is invoked during the stringification of the paragraphs as due to
the Paragraph::asString() method, when the cursor is right on the quote)
Now, on one hand I would suspect this to not be related to the AdvSearch
patch, but on the other hand no assertion failure occurs during the
normal
search.
Any clue ?
One possibility is that the InsetQuote is being copied, but the copy
isn't getting the buffer set right. I used to know about this but
can't remember now exactly what the issue was or how it got fixed.
Maybe Andre or Abdel will remember.
As for all insets, the buffer is unset (== set to zero) when the inset
is copied (i.e. when put in the c&p stack). It is set again when it is
pasted, it is of course set to the Buffer to which the inset is pasted
which is not necessarily the same). In the interim period, the buffer is
not set and any manipulation not involving cut&paste can be dangerous. I
guess the problem here is that AdvSearch manipulates a copy without
setting the buffer. The solution I think is to use an interim, internal
Buffer in the AdvSearch workArea.
The attached patch avoids the assertion,
Why not a const ref instead of a copy?
if (cur.inTexted()) {
- Paragraph par = cur.paragraph();
+ Paragraph const& par = cur.paragraph();
// TODO what about searching beyond/across paragraph breaks ?
// TODO Try adding a AS_STR_INSERTS as last arg
return par.asString(cur.pos(), ( len == -1 || cur.pos() + len>
int(par.size()) ) ? int(par.size()) : cur.pos() + len, AS_STR_INSETS);
but then lyx seems to hang
on quit. Maybe something similar to what you fixed recently?
No idea...
Abdel.