summaryrefslogtreecommitdiffstats
path: root/c++/src/H5Attribute.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'c++/src/H5Attribute.cpp')
-rw-r--r--c++/src/H5Attribute.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp
index 87521e1..bdb6276 100644
--- a/c++/src/H5Attribute.cpp
+++ b/c++/src/H5Attribute.cpp
@@ -381,9 +381,6 @@ void Attribute::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();
}
//--------------------------------------------------------------------------
@@ -402,8 +399,10 @@ void Attribute::close()
{
throw AttributeIException("Attribute::close", "H5Aclose failed");
}
- // reset the id because the attribute that it represents is now closed
- id = 0;
+ // reset the id when the attribute that it represents is no longer
+ // referenced
+ if (getCounter() == 0)
+ id = 0;
}
}