kicad-developers team mailing list archive
Mailing list archive
Re: operator new in board.cpp
On 12/5/2011 12:30 AM, Dick Hollenbeck wrote:
> I think the lines involving operator new() may blow up at runtime when the corresponding
> delete  is called.
I'm not using
delete foo; // This is not the same as delete foo[nn];
where the contents of foo are allocated using
foo = new();
delete foo[nn]; // This is the same as tmp* = foo[nn]; delete tmp;
where the contents of the array of foo pointers is assigned using
foo[nn] = new( sizeof(foo) );
In the case of m_BoardSide it is defined in the board class as
so I'm just filling the array of pointers with the new() operator so delete()
should work properly.
> Have you tested this code?
I ran the auto router and didn't it segfault and it generated the same results
as the old code so it appears to be correct.
> You should probably use the
> new OBJECT[size]
> syntax instead, so the new style matches the delete style.
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help : https://help.launchpad.net/ListHelp