summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5.c33
1 files changed, 24 insertions, 9 deletions
diff --git a/src/H5.c b/src/H5.c
index 95dfea9..e84aebf 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -213,20 +213,35 @@ H5_term_library(void)
do {
pending = 0;
- pending += DOWN(F);
- pending += DOWN(FD);
+ /* Try to organize these so the "higher" level components get shut
+ * down before "lower" level components that they might rely on. -QAK
+ */
+ pending += DOWN(R);
pending += DOWN(D);
- pending += DOWN(Z);
pending += DOWN(G);
- pending += DOWN(FL);
- pending += DOWN(R);
+ pending += DOWN(A);
pending += DOWN(S);
pending += DOWN(TN);
pending += DOWN(T);
- pending += DOWN(A);
- pending += DOWN(AC);
- pending += DOWN(P);
- pending += DOWN(I);
+ /* Don't shut down the file code until objects in files are shut down */
+ if(pending==0)
+ pending += DOWN(F);
+
+ /* Don't shut down "low-level" components until "high-level" components
+ * have successfully shut down. This prevents property lists and IDs
+ * from being closed "out from underneath" of the high-level objects
+ * that depend on them. -QAK
+ */
+ if(pending==0) {
+ pending += DOWN(AC);
+ pending += DOWN(Z);
+ pending += DOWN(FD);
+ pending += DOWN(P);
+ pending += DOWN(I);
+ /* Don't shut down the free list code until _everything_ else is down */
+ if(pending==0)
+ pending += DOWN(FL);
+ }
} while (pending && ntries++ < 100);
if (pending) {