[svn-r12368] Purpose: Fixed bug
Description:
Shanti compiler destroy unnamed objects later than others, which caused
some reference counting test fail. Revised the test so that destructors
are called at the same time, regardless the differences of compiler
implementation.
Revised some constructors, close, operator=, and destructors to make
sure that all the object ids are handled properly.
Platforms tested:
Linux 2.4 (heping)
SunOS 5.9 (shanti)
HPUX 11.00 (kelgia)
AIX 5.1 (copper)
This commit is contained in:
@@ -46,7 +46,7 @@ namespace H5 {
|
||||
///\brief Default constructor: creates a stub DataSet.
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
DataSet::DataSet() : AbstractDs() {}
|
||||
DataSet::DataSet() : AbstractDs() {}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DataSet overloaded constructor
|
||||
@@ -521,13 +521,16 @@ DataSpace DataSet::getRegion(void *ref, H5R_type_t ref_type) const
|
||||
//--------------------------------------------------------------------------
|
||||
void DataSet::close()
|
||||
{
|
||||
herr_t ret_value = H5Dclose( id );
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw DataSetIException("DataSet::close", "H5Dclose failed");
|
||||
}
|
||||
// reset the id because the dataset that it represents is now closed
|
||||
id = 0;
|
||||
if (p_valid_id(id))
|
||||
{
|
||||
herr_t ret_value = H5Dclose( id );
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw DataSetIException("DataSet::close", "H5Dclose failed");
|
||||
}
|
||||
// reset the id because the dataset that it represents is now closed
|
||||
id = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -540,12 +543,11 @@ void DataSet::close()
|
||||
//--------------------------------------------------------------------------
|
||||
DataSet::~DataSet()
|
||||
{
|
||||
// The dataset id will be closed properly
|
||||
try {
|
||||
decRefCount();
|
||||
close();
|
||||
}
|
||||
catch (Exception close_error) {
|
||||
cerr << "DataSet::~DataSet - " << close_error.getDetailMsg() << endl;
|
||||
cerr << "DataSet::~DataSet - " << close_error.getDetailMsg() << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user