On Thu, Feb 28, 2008 at 03:33:47PM +0100, Abdelrazak Younes wrote:
> Helge Hafting wrote:
>> Whenever I press shift+2 to get an apostrophe (which
>> LyX normally change to a << or >> sign, things goes wrong.
>> I get a silly dialog box where the caption says:
>> LyX: Inset::buffer_member... (The rest is cut off)
>> Inside the box, there is the uninformative
>> sentence "LyX Code:2" and an "OK" button.
>> Pressing "ok" just makes this dialog pop up
>> again and again, in an infinite loop.
>> On the command line, I also get:
>> "Warning: Inset::buffer_ member not initialized!
>> "LyX Code: 2"
>> The only solution is to kill LyX.
>
> Latest trunk should exit after the first
>
>> When I restart it,
>> the emergency saved file is loaded
>> and I see that I got my << or >> as I wanted,
>> but this way of writing is cumbersome.
>
> As I said elsewhere, following Andre's buffer in inset change, the silly 
> message is necessary to know which inset needs fixing. I will fix 
> InsetQuote.

As rule of thumb (not directed to you, Abdel, but to the general
audience) we right now get crashes for insets that are not constructed
in the inset factory (or by copy construction).

Problems can be solved by the following recipe:

The LyX code 2 in the error can be 'translated' by using insets/InsetCode.h
into 'QUOTE_CODE', and

        [EMAIL PROTECTED]:/data/lyx/trunk > g 'new InsetQuote'
        src/Text3.cpp:                          cur.insert(new InsetQuotes(c,
        src/Text3.cpp:                          cur.insert(new InsetQuotes(c,
        src/insets/InsetQuotes.cpp:     return new InsetQuotes(language_, side_,
        times_);
        src/factory.cpp:                        inset.reset(new InsetQuotes);

nicely points to the problem areas: The use in factory.cpp is fine. In
InsetQuotes.cpp should use the canonical form

        Inset * InsetQuotes::clone() const
        {
                //return new InsetQuotes(language_, side_, times_);  // NOT!
                return new InsetQuotes(*this);
        }
 
and the two calls in Text3.cpp should use the inset factory (preferably)
or call  ->setBuffer(...)  manually as "Hotfix" (less preferable).

Andre'

Reply via email to