Hi

I just tried your example on Linux and I was not able to reproduce your error. 
Also valgrind does not show any errors.

While reading the source, I think I know what the problem is.....

PdfTable::SetColumnWidth is inlined. So even if PoDoFo allocates the memory 
itself and copies the array, the allocator of your application is used 
instead of the allocator of the PoDoFo dll. Does statically linking podofo to 
your testcase fix the problem? Alternatively you could try to not make 
PdfTable::SetColumnWidth inlined. 

If this fixes your issue, I will go through the source and fix all allocations 
with new in inlined functions ....

best regards,
        Dom

Am Samstag, 25. Juli 2009 schrieb [email protected]:
> This is the code. When createTable2 function finishes the error is thrown.
>
> //----------------------------------------------------------------------
> void createTable2( PdfPainter* pPainter, PdfFont* pFont, double pageSize )
> { PdfTable table( 3, 5 );
> PdfSimpleTableModel tableModel( table.GetCols(), table.GetRows() );
>
> double colWidths[] = { 90.0, 45.0, 45.0 };
> table.SetColumnWidths( colWidths );
>
> tableModel.SetFont( pFont );
> tableModel.SetForegroundColor( PdfColor( 0.0 ) );
> tableModel.SetBorderWidth(
>
> borderSize);
> tableModel.SetAlignment( ePdfVerticalAlignment_Bottom );
> tableModel.SetAlignment( ePdfAlignment_Center );
>
> // Line 1
> tableModel.SetText( 0, 0, "Pilot1/Pilot2" );
> tableModel.SetText( 1, 0, "Tail" );
> tableModel.SetText( 2, 0, "IFF" );
>
> table.SetModel( &tableModel );
>
> table.SetRowHeight( pFont->GetFontSize()*1.6 );
> table.SetTableWidth(180);
>
> table.Draw( 50.0, pageSize - 110.0, pPainter );
> }
>
> void report( const char* pszFilename )
> {
> PdfStreamedDocument document( pszFilename );
>
> PdfPage* pPage;
> pPage = document.CreatePage( PdfPage::CreateStandardPageSize(
> ePdfPageSize_A4, true ) );
> if( !pPage ) {
> PODOFO_RAISE_ERROR( ePdfError_InvalidHandle );
> }
>
> PdfFont* pFont;
> pFont = document.CreateFont( "Arial" );
> if( !pFont ) {
> PODOFO_RAISE_ERROR( ePdfError_InvalidHandle );
> }
> pFont->SetFontSize( 8.0 );
>
> PdfPainter painter;
> painter.SetPage( pPage );
> painter.SetFont( pFont );
>
> double pageHeight = pPage->GetPageSize().GetHeight();
>
>  double pageCenter = pPage->GetPageSize().GetWidth() / 2;
> painter.FillRect( pageCenter, 60.0, 0.0, pageHeight - 40.0 - 60.0 );
>
> createTable2( &painter, pFont, pageHeight );
> painter.FinishPage();
>
> document.GetInfo()->SetCreator ( PdfString("examplahelloworld - A PoDoFo
> test application") );
> document.GetInfo()->SetAuthor ( PdfString("Dominik Seichter") );
> document.GetInfo()->SetTitle ( PdfString("Hello World") );
> document.GetInfo()->SetSubject ( PdfString("Testing the PoDoFo PDF
> Library") );
> document.GetInfo()->SetKeywords( PdfString("Test;PDF;Hello World;") );
>
> document.Close();
> }
>
> int _tmain(int argc, _TCHAR* argv[])
> {
>
> char* fileName = "PPP.pdf";
>
> try {
> report( fileName );
> } catch( const PdfError & eCode ) {
> eCode.PrintErrorMsg();
> return eCode.GetError();
> }
>
> return 0;
> }
>
>
> On Fri, Jul 24, 2009 at 12:17 AM, Craig Ringer
>
> <[email protected]>wrote:
> > On Thu, 2009-07-23 at 19:40 -0300, [email protected] wrote:
> > > Hi,
> > >
> > > I am a new user of PoDoFo library. I caught the last release (0.7.0)
> > > from sourceforge and compiled it using Visual Studio .Net 2003
> > > Professional in windows XP.
> > >
> > > I've started to test it to make simple reports and when I used the
> > > function PdfTable.SetColumnWidths the error below is thrown when
> > > destructor function of the PdfTable class is called.
> >
> > Can you post a self-contained test program that demonstrates the
> > problem? I don't see any glaringly obvious error in that code that'd
> > cause a double delete[].
> >
> > --
> > Craig Ringer



-- 
**********************************************************************
Dominik Seichter - [email protected]
KRename  - http://www.krename.net  - Powerful batch renamer for KDE
KBarcode - http://www.kbarcode.net - Barcode and label printing
PoDoFo - http://podofo.sf.net - PDF generation and parsing library
SchafKopf - http://schafkopf.berlios.de - Schafkopf, a card game,  for KDE
Alan - http://alan.sf.net - A Turing Machine in Java
**********************************************************************

Attachment: signature.asc
Description: This is a digitally signed message part.

------------------------------------------------------------------------------
_______________________________________________
Podofo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to