From b0a1e95ac7de5d0235dc0bc0732f4225b1589bad Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Wed, 15 Sep 2010 23:13:25 -0500 Subject: [svn-r19394] Purpose: Fixed bug 1903 Description: After a C++ API object is closed, its id should be reset regardless of the reference count of the underlying HDF5 object. User reported the bug for Group, but it's applicable to all other objects. Fixed. Platforms tested: Linux/32 2.6 (jam) FreeBSD/64 6.3 (liberty) SunOS 5.10 (linew) --- c++/src/H5Attribute.cpp | 6 ++---- c++/src/H5DataSet.cpp | 6 ++---- c++/src/H5DataSpace.cpp | 6 ++---- c++/src/H5DataType.cpp | 6 ++---- c++/src/H5File.cpp | 6 ++---- c++/src/H5Group.cpp | 6 ++---- c++/src/H5PropList.cpp | 6 ++---- 7 files changed, 14 insertions(+), 28 deletions(-) diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp index 27061de..3f1e839 100644 --- a/c++/src/H5Attribute.cpp +++ b/c++/src/H5Attribute.cpp @@ -508,10 +508,8 @@ void Attribute::close() { throw AttributeIException("Attribute::close", "H5Aclose failed"); } - // reset the id when the attribute that it represents is no longer - // referenced - if (getCounter() == 0) - id = 0; + // reset the id + id = 0; } } diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp index 92b68b5..0639dd4 100644 --- a/c++/src/H5DataSet.cpp +++ b/c++/src/H5DataSet.cpp @@ -800,10 +800,8 @@ void DataSet::close() { throw DataSetIException("DataSet::close", "H5Dclose failed"); } - // reset the id when the dataset that it represents is no longer - // referenced - if (getCounter() == 0) - id = 0; + // reset the id + id = 0; } } diff --git a/c++/src/H5DataSpace.cpp b/c++/src/H5DataSpace.cpp index 37fb47a..755ca5b 100644 --- a/c++/src/H5DataSpace.cpp +++ b/c++/src/H5DataSpace.cpp @@ -612,10 +612,8 @@ void DataSpace::close() { throw DataSpaceIException("DataSpace::close", "H5Sclose failed"); } - // reset the id when the dataspace that it represents is no longer - // referenced - if (getCounter() == 0) - id = 0; + // reset the id + id = 0; } } diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp index 4c995e3..6e894dc 100644 --- a/c++/src/H5DataType.cpp +++ b/c++/src/H5DataType.cpp @@ -781,10 +781,8 @@ void DataType::close() { throw DataTypeIException(inMemFunc("close"), "H5Tclose failed"); } - // reset the id when the datatype that it represents is no longer - // referenced - if (getCounter() == 0) - id = 0; + // reset the id + id = 0; } } diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp index 086022e..e60d90d 100644 --- a/c++/src/H5File.cpp +++ b/c++/src/H5File.cpp @@ -772,10 +772,8 @@ void H5File::close() { throw FileIException("H5File::close", "H5Fclose failed"); } - // reset the id when the file that it represents is no longer - // referenced - if (getCounter() == 0) - id = 0; + // reset the id + id = 0; } } diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp index 410261f..6ec2dbb 100644 --- a/c++/src/H5Group.cpp +++ b/c++/src/H5Group.cpp @@ -251,10 +251,8 @@ void Group::close() { throw GroupIException("Group::close", "H5Gclose failed"); } - // reset the id when the group that it represents is no longer - // referenced - if (getCounter() == 0) - id = 0; + // reset the id + id = 0; } } diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp index 1ed5916..ceea15f 100644 --- a/c++/src/H5PropList.cpp +++ b/c++/src/H5PropList.cpp @@ -270,10 +270,8 @@ void PropList::close() { throw PropListIException(inMemFunc("close"), "H5Pclose failed"); } - // reset the id when the property list that it represents is no longer - // referenced - if (getCounter() == 0) - id = 0; + // reset the id + id = 0; } } -- cgit v0.12