André Pönitz <andre.poen...@mathematik.tu-chemnitz.de> writes:

| On Sun, Nov 20, 2011 at 11:46:10PM +0100, Lars Gullik Bjønnes wrote:
>> 
>> Even if gcc 4.7 has not been released (quite far from), it might be
>> nice to test compile with it anyway.
>
| Sure.
|  
>> Here are the results:
>>  
>> GuiWorkArea.cpp: In destructor ‘virtual
>> lyx::frontend::GuiWorkArea::~GuiWorkArea()’: GuiWorkArea.cpp:327:9:
>> warning: deleting object of polymorphic class type
>> ‘lyx::frontend::GuiWorkArea::Private’ which has non-virtual destructor
>> might cause undefined behaviour [-Wdelete-non-virtual-dtor]
>
| I see " : d(new Private)" and "delete d;".  Where is the problem?

The (potential) problem is a destructor in a parent class that is not
marked virtual. If anything is allocated in the that class it will not
be destroyed through the polymorfic pointer.

It might very well be that gcc is a tad mistaken, but if
EmbeddedWorkArea, then GuiWorkArea should
have a virtual destructor.

(I cannot see how GuiWorkArea::Private plays into this.)

| Arguably, the two 'virtual' in showCursor and removeCursor are not
| needed, but legal and harmless. Is that what the compiler is helpfully
| trying to hint at? If so, why doesn't it say so?

>> [...]
>> insets/InsetListingsParams.cpp: In constructor 
>> ‘lyx::{anonymous}::ParValidator::ParValidator()’:
>> insets/InsetListingsParams.cpp:280:1: note: variable tracking size limit 
>> exceeded with -fvar-tracking-assignments, retrying without
>
| Looks rather like a problem of the compiler, not of the code.

what I said...

-- 
   Lgb

Reply via email to