Changes between Initial Version and Version 1 of Ticket #5959


Ignore:
Timestamp:
May 12, 2015, 9:58:46 AM (9 years ago)
Author:
yzhong
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #5959 – Description

    initial v1  
    11I think we should add a copy constructor to OGRFeatureDefn. Otherwise, the following code will crash. The reason is obvious that the memory of papoGeomFieldDefn is getting released.
    22       
     3
     4{{{
    35        OGRFeatureDefn oFeatureDefn;
     6        oFeatureDefn = OGRFeatureDefn( pszLayerName );
     7        oFeatureDefn.SetGeomType( wkbNone ); // crash
     8}}}
    49
    5         oFeatureDefn = OGRFeatureDefn( pszLayerName );
    6 
    7         oFeatureDefn.SetGeomType( wkbNone ); // crash
    810
    911If you don't want to implement the copy constructor, should at least mark it as delete (C++11) or make it private to prevent developers of making mistakes by calling it.