On Sun, Jul 13, 2008 at 10:05:05PM +0200, Abdelrazak Younes wrote:
> [EMAIL PROTECTED] wrote:
>> Author: rgheck
>> Date: Sun Jul 13 21:34:56 2008
>> New Revision: 25584
>> URL: http://www.lyx.org/trac/changeset/25584
>> Log:
>> Redo 25580 the right way. (Failure to initialize bparams had caused 
>> constant crashes.)
>> Modified:
>>     lyx-devel/trunk/src/Undo.cpp
>> Modified: lyx-devel/trunk/src/Undo.cpp
>> URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/Undo.cpp?rev=25584
>> ==============================================================================
>> --- lyx-devel/trunk/src/Undo.cpp (original)
>> +++ lyx-devel/trunk/src/Undo.cpp Sun Jul 13 21:34:56 2008
>> @@ -73,8 +73,13 @@
>>                  MathData * ar, BufferParams const & bp,                 
>> bool 
>> ifb) :
>>              kind(kin), cursor(cur), cell(cel), from(fro), end(en),
>> -            pars(pl), array(ar), bparams(bp), isFullBuffer(ifb)
>> -    {}
>> +            pars(pl), array(ar), bparams(0), isFullBuffer(ifb)
>> +    {
>> +            if (isFullBuffer)
>> +                    bparams = new BufferParams(bp);
>> +    }
>> +    ///
>> +    ~UndoElement() { delete bparams; }
>
> No, please replace that with
>
>       if (isFullBuffer)
>               delete bparams;
>
> Because UndoElement do not own bparams in the other case.

Having that in the destructor does not look safe as this would mean 
we have to make sure that e.g. no temporary UndoElements are created...

Andre'

Reply via email to