diff options
author | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2008-07-18 20:49:32 (GMT) |
---|---|---|
committer | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2008-07-18 20:49:32 (GMT) |
commit | d6dc8a4dfd95ea0e6b3b6d9cfbb8ea5aad4c19d3 (patch) | |
tree | c025346989add6028cfa41893f0641171b22663d /c++/src/H5Group.cpp | |
parent | 99e21e85c94327b6a525aa87a6d11547fc944f41 (diff) | |
download | hdf5-d6dc8a4dfd95ea0e6b3b6d9cfbb8ea5aad4c19d3.zip hdf5-d6dc8a4dfd95ea0e6b3b6d9cfbb8ea5aad4c19d3.tar.gz hdf5-d6dc8a4dfd95ea0e6b3b6d9cfbb8ea5aad4c19d3.tar.bz2 |
[svn-r15386] Purpose: Fix bug
Description:
A bug in reference counter was exposed when Ray fixed H5Awrite in
the main library. ::setId() called incRefCount when it shouldn't.
Made sure that id's reference counter is manually incremented
properly in copy constructor and operator= only. The main library
handles the rest.
Platforms tested:
SunOS 5.10 (linew)
Linux 2.6 (kagiso)
FreeBSD (duty)
Diffstat (limited to 'c++/src/H5Group.cpp')
-rw-r--r-- | c++/src/H5Group.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp index 7ab3b61..6014466 100644 --- a/c++/src/H5Group.cpp +++ b/c++/src/H5Group.cpp @@ -192,9 +192,6 @@ void Group::setId(const hid_t new_id) } // reset object's id to the given id id = new_id; - - // increment the reference counter of the new id - incRefCount(); } //-------------------------------------------------------------------------- @@ -206,8 +203,6 @@ void Group::setId(const hid_t new_id) //-------------------------------------------------------------------------- void Group::close() { - /* cerr << "Group::close/p_valid_id" << endl; - */ if (p_valid_id(id)) { herr_t ret_value = H5Gclose( id ); @@ -215,8 +210,10 @@ void Group::close() { throw GroupIException("Group::close", "H5Gclose failed"); } - // reset the id because the group that it represents is now closed - id = 0; + // reset the id when the group that it represents is no longer + // referenced + if (getCounter() == 0) + id = 0; } } |