Changes between Initial Version and Version 2 of Ticket #5045


Ignore:
Timestamp:
Apr 3, 2013, 2:56:17 AM (11 years ago)
Author:
cpponly2008
Comment:

Replying to rouault:

Using the C++ API isn't recommanded from the exterior of GDAL if you don't use the same compiler & compiler options in both your program and GDAL.

The error in your code is to call oPolygon1->addRingDirectly(&oLR1); that will take ownership of the linear ring and try to delete it. You should rather use addRing() that will make a copy (or dynamically allocate the ring with new, but then you can run into cross-heap issues)

Sorry, I used addRing(), then the crash occurred too.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #5045

    • Property Status newclosed
    • Property Resolutioninvalid
  • Ticket #5045 – Description

    initial v2  
    1717        oLR1.addPoint(&op4);
    1818        oLR1.addPoint(&op5);
    19         oPolygon1->addRingDirectly(&oLR1);
     19        oPolygon1->addRing(&oLR1);//also crashed
    2020        delete oPolygon1;
    2121}