Skip to content

Commit

Permalink
Reversed the order in which shutdown functions are called.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff-cohere committed Aug 5, 2021
1 parent 97e5ea1 commit 6e702a0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/tdycore.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ PetscErrorCode TDyOnFinalize(void (*shutdown_func)(void)) {
PetscErrorCode TDyFinalize() {
PetscFunctionBegin;

// Call shutdown functions and destroy the list.
// Call shutdown functions in reverse order, and destroy the list.
if (shutdown_funcs_ != NULL) {
for (int i = 0; i < num_shutdown_funcs_; ++i) {
for (int i = num_shutdown_funcs_-1; i >= 0; --i) {
shutdown_funcs_[i]();
}
free(shutdown_funcs_);
Expand Down

0 comments on commit 6e702a0

Please sign in to comment.