On Mon, Jul 14, 2008 at 06:52:21PM +0200, Abdelrazak Younes wrote:
> Abdelrazak Younes wrote:
>> [EMAIL PROTECTED] wrote:
>>> Author: rgheck Date: Mon Jul 14 18:12:12 2008 New Revision: 25617
>>>
>>> URL: http://www.lyx.org/trac/changeset/25617 Log: I don't know at all
>>> what's up here with copied_ptr. Hadn't even heard of it until five
>>> minutes ago. ;-) You can cause this crash by opening a new document,
>>> opening Document>Settings and changing (say) the Bibliography
>>> settings, and then hitting "OK".
>>
>> Richard, I told you at least three times that bparams deletion needs to be 
>> protected with if(isFullBuffer)...
>
> Of course that doesn't mean that the crash would be solved (haven't tested 
> yet). I think we also need a copy ctor for UndoElement.

We do not if we take the same approach as for MathData and the
ParagraphsListList:  'new' if needed, 'delete' if it is _really_
unused, i.e. _not_ put on the 'other' stack. This means the delete
can't be in the desctructor as this would be triggered also for
temporaries (or when the containers would relocate - since they
are std::deque they won't, but that's more or less a coincidence). 

This way copies can remain shallow and therfore _really_ cheap.
Everything else is more expensive, especially since the contents
might be huge (as in "full documents"). 

Not directed to Abdel but to the wider audience:

It just requires a bit more discipline within an area spanning
50 lines or code so. It's not _that_ difficult, people have been
(and are still) coding like that in C for three decades... it's
also not to difficult _not_ to fumble there: just don't touch it.
*sigh*

Andre'

Reply via email to