diff options
author | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2000-12-23 13:17:32 (GMT) |
---|---|---|
committer | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2000-12-23 13:17:32 (GMT) |
commit | d24bacb8a47f945e6919f067e8057ad30012bd5a (patch) | |
tree | 2844b08018435b9d33f68ef4b787d5434db66d5a /c++/src/H5DataType.cpp | |
parent | 45c5dd949f7dd4549dc5996ff8395652ef3d9dda (diff) | |
download | hdf5-d24bacb8a47f945e6919f067e8057ad30012bd5a.zip hdf5-d24bacb8a47f945e6919f067e8057ad30012bd5a.tar.gz hdf5-d24bacb8a47f945e6919f067e8057ad30012bd5a.tar.bz2 |
[svn-r3199]
Purpose: bug fix
Description:
I found a couple of places where virtual destructors were missing
and could cause small memory leaks. Also, some destructors were
not virtual when they should be.
Solution:
- added virtual destructors, which also free dynamically allocated
memory
- added virtual to several destructors
- also, fixed several typos
Platforms tested:
Solaris 2.7 (arabica)
Diffstat (limited to 'c++/src/H5DataType.cpp')
-rw-r--r-- | c++/src/H5DataType.cpp | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp index b376f61..889d233 100644 --- a/c++/src/H5DataType.cpp +++ b/c++/src/H5DataType.cpp @@ -53,10 +53,16 @@ void DataType::copy( const DataType& like_type ) // call C routine to copy the datatype id = H5Tcopy( like_type.getId() ); + ref_count = new RefCounter; + +/* +id != like_type.id so this object has a different ref_count than +like_type ref_count = like_type.ref_count; // increment ref counter to indicate additional references to this id ref_count->increment(); +*/ if( id <= 0 ) { @@ -85,27 +91,11 @@ bool DataType::operator==(const DataType& compared_type ) const // the parameter list??? //int DataType::iterate( unsigned * idx, H5A_operator_t op, void *op_data ) //{ - // Call C routine H5Aiterate to iterate the object's attributes - //int ret_value = H5Aiterate( id, idx, op, op_data ); - //if( ret_value >= 0 ) - //return( ret_value ); - //else - //{ - //throw DataTypeIException(); - //} //} // Creates a new variable-length datatype - Note: make it inheritance??? //DataType DataType::vlenCreate( const DataType& base_type ) //{ - // Call C routine to create a new VL datatype - //hid_t type_id = H5Tvlen_create( id ); - //if( type_id > 0 ) - //id_obj->setId( type_id ); - //else - //{ - //throw DataTypeIException(); - //} //} // Commits a transient datatype to a file, creating a new named datatype @@ -237,7 +227,7 @@ DataType DataType::getSuper() const DataType base_type( base_type_id ); return( base_type ); } - else {} + else { throw DataTypeIException(); } |