mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-02-17 16:10:24 +08:00
[svn-r18747] Purpose: Fixed bug 1599
Description: Fixed operator= to use setId() properly. Platforms tested: Linux/32 2.6 (jam) FreeBSD/64 6.3 (liberty) SunOS 5.10 (linew)
This commit is contained in:
parent
1c9e998d0d
commit
fe49632588
@ -161,6 +161,10 @@ H5I_type_t IdComponent::getHDFObjType(const hid_t obj_id)
|
||||
// copy the id from rhs to this object, and increment the
|
||||
// reference counter of the id to indicate that another object
|
||||
// is referencing that id.
|
||||
// Modification
|
||||
// 2010/5/9 - BMR
|
||||
// Removed close() and incRefCount() because setId/p_setId takes
|
||||
// care of close() and setId takes care incRefCount().
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
IdComponent& IdComponent::operator=( const IdComponent& rhs )
|
||||
@ -169,16 +173,13 @@ IdComponent& IdComponent::operator=( const IdComponent& rhs )
|
||||
{
|
||||
// handling references to this id
|
||||
try {
|
||||
close();
|
||||
setId(rhs.getId());
|
||||
// Note: a = b, so there are two objects with the same hdf5 id
|
||||
// that's why incRefCount is needed, and it is called by setId
|
||||
}
|
||||
catch (Exception close_error) {
|
||||
throw FileIException(inMemFunc("operator="), close_error.getDetailMsg());
|
||||
}
|
||||
|
||||
// copy the data members from the rhs object
|
||||
p_setId(rhs.getId());
|
||||
incRefCount(getId()); // a = b, so there are two objects with the same
|
||||
// hdf5 id
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@ -190,9 +191,8 @@ IdComponent& IdComponent::operator=( const IdComponent& rhs )
|
||||
///\exception H5::IdComponentException when the attempt to close the HDF5
|
||||
/// object fails
|
||||
// Description:
|
||||
// The underlaying reference counting in the C library ensures
|
||||
// that the current valid id of this object is properly closed.
|
||||
// Then the object's id is reset to the new id.
|
||||
// p_setId ensures that the current valid id of this object is
|
||||
// properly closed before resetting the object's id to the new id.
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
// Modification
|
||||
// 2008/7/23 - BMR
|
||||
|
Loading…
Reference in New Issue
Block a user