Opened 9 years ago

Closed 9 years ago

#5959 closed enhancement (duplicate)

Add a copy constructor and copy assignment operator to OGRFeatureDefn

Reported by: yzhong Owned by: warmerdam
Priority: normal Milestone:
Component: default Version: svn-trunk
Severity: normal Keywords:
Cc:

Description (last modified by yzhong)

I think we should add a copy constructor and copy assignment operator to OGRFeatureDefn. Otherwise, the following code will crash. The reason is obvious that the memory of papoGeomFieldDefn is getting released.

        OGRFeatureDefn oFeatureDefn;
        oFeatureDefn = OGRFeatureDefn( pszLayerName );
        oFeatureDefn.SetGeomType( wkbNone ); // crash

Should at least mark it as delete (C++11) or make it private to prevent developers of making mistakes by calling it. As a matter of fact, adding all rule of 5 will be better.

Change History (6)

comment:1 by yzhong, 9 years ago

Description: modified (diff)

comment:2 by yzhong, 9 years ago

Description: modified (diff)
Type: defectenhancement

comment:3 by yzhong, 9 years ago

Description: modified (diff)
Summary: Add a copy constructor to OGRFeatureDefnAdd a copy constructor and copy assignment operator to OGRFeatureDefn

comment:4 by Even Rouault, 9 years ago

More or less linked to #5043

comment:5 by Even Rouault, 9 years ago

Milestone: 2.0

Removing obsolete milestone

comment:6 by Even Rouault, 9 years ago

Resolution: duplicate
Status: newclosed

Dealt by #6100

Note: See TracTickets for help on using tickets.