Changeset 11679

Show
Ignore:
Timestamp:
06/21/07 00:37:50 (1 year ago)
Author:
warmerdam
Message:

complete spatialref reference counting fix (bug #1680)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/gdal/swig/include/ogr.i

    r11678 r11679  
    549549  } 
    550550   
    551  
     551  %newobject GetSpatialRef; 
    552552  OSRSpatialReferenceShadow *GetSpatialRef() { 
    553553    OGRSpatialReferenceH ref =  OGR_L_GetSpatialRef(self); 
    554     OSRReference(ref); 
     554    if( ref ) 
     555        OSRReference(ref); 
    555556    return (OSRSpatialReferenceShadow*) ref; 
    556557  } 
     
    13011302  } 
    13021303   
     1304  %newobject GetSpatialReference; 
    13031305  OSRSpatialReferenceShadow* GetSpatialReference() { 
    1304     return (OSRSpatialReferenceShadow*)OGR_G_GetSpatialReference(self); 
     1306    OGRSpatialReferenceH ref =  OGR_G_GetSpatialReference(self); 
     1307    if( ref ) 
     1308        OSRReference(ref); 
     1309    return (OSRSpatialReferenceShadow*) ref; 
    13051310  } 
    13061311   
  • trunk/gdal/swig/python/ogr_wrap.cpp

    r11672 r11679  
    25812581#include "cpl_port.h" 
    25822582#include "cpl_string.h" 
     2583#include "ogr_srs_api.h" 
    25832584 
    25842585typedef void OSRSpatialReferenceShadow; 
     
    30623063  } 
    30633064SWIGINTERN OSRSpatialReferenceShadow *OGRLayerShadow_GetSpatialRef(OGRLayerShadow *self){ 
    3064     return (OSRSpatialReferenceShadow*) OGR_L_GetSpatialRef(self); 
     3065    OGRSpatialReferenceH ref =  OGR_L_GetSpatialRef(self); 
     3066    if( ref ) 
     3067        OSRReference(ref); 
     3068    return (OSRSpatialReferenceShadow*) ref; 
    30653069  } 
    30663070SWIGINTERN GIntBig OGRLayerShadow_GetFeaturesRead(OGRLayerShadow *self){ 
     
    35363540  } 
    35373541SWIGINTERN OSRSpatialReferenceShadow *OGRGeometryShadow_GetSpatialReference(OGRGeometryShadow *self){ 
    3538     return (OSRSpatialReferenceShadow*)OGR_G_GetSpatialReference(self); 
     3542    OGRSpatialReferenceH ref =  OGR_G_GetSpatialReference(self); 
     3543    if( ref ) 
     3544        OSRReference(ref); 
     3545    return (OSRSpatialReferenceShadow*) ref; 
    35393546  } 
    35403547SWIGINTERN void OGRGeometryShadow_AssignSpatialReference(OGRGeometryShadow *self,OSRSpatialReferenceShadow *reference){ 
     
    57375744    } 
    57385745  } 
    5739   resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 ); 
     5746  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OSRSpatialReferenceShadow, SWIG_POINTER_OWN |  0 ); 
    57405747  return resultobj; 
    57415748fail: 
     
    1074310750    } 
    1074410751  } 
    10745   resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 ); 
     10752  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OSRSpatialReferenceShadow, SWIG_POINTER_OWN |  0 ); 
    1074610753  return resultobj; 
    1074710754fail: