summaryrefslogtreecommitdiffstats
path: root/c++/src/H5IdComponent.cpp
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2010-05-09 19:50:32 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2010-05-09 19:50:32 (GMT)
commitfe49632588af7cafdd220998be6006d91ed0247c (patch)
tree8d71d4085d460150a51eded1c0d8ee1944e8047c /c++/src/H5IdComponent.cpp
parent1c9e998d0d7e74797a4a00a0704a363a02f81a0f (diff)
downloadhdf5-fe49632588af7cafdd220998be6006d91ed0247c.zip
hdf5-fe49632588af7cafdd220998be6006d91ed0247c.tar.gz
hdf5-fe49632588af7cafdd220998be6006d91ed0247c.tar.bz2
[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)
Diffstat (limited to 'c++/src/H5IdComponent.cpp')
-rw-r--r--c++/src/H5IdComponent.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp
index ef01105..1cac0c1 100644
--- a/c++/src/H5IdComponent.cpp
+++ b/c++/src/H5IdComponent.cpp
@@ -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