kicad-developers team mailing list archive
Mailing list archive
Re: Question about PCB_PARSER
On Tue, Aug 07, 2012 at 11:39:58AM +0200, Lorenzo Marcantonio wrote:
> I think that simply passing a LINEREADER built on the stack would work... also we need to be careful with dynamic allocation since there are exception runnings in that section of code (and these need to be catched to delete the dynamic objects).
OK, tried that, did not work :((((
PARSER parser(new FILE_LINE_READER( file.fp(), aFileName ), this );
seems to work (no idea if the filereader is deleted after). Trying instead with
FILE_LINE_READER reader( file.fp(), aFileName );
PARSER parser( &reader, this );
triggers a libc fault on stack unwind (probably due to a double free).
So a) the parser actually take possession of the reader and deletes it
or b) there's something that is not exception safe around...
This needs further investigation (maybe it's only the comment that's wrong!)