Skip to content

Commit

Permalink
Fix potential bug of lang::Program that could be double finalized (#5550
Browse files Browse the repository at this point in the history
)
  • Loading branch information
PGZXB committed Jul 28, 2022
1 parent 719a927 commit 0aa0a17
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions taichi/program/program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,9 @@ uint64 Program::fetch_result_uint64(int i) {
}

void Program::finalize() {
if (finalized_) {
return;
}
synchronize();

TI_TRACE("Program finalizing...");
Expand Down Expand Up @@ -498,8 +501,7 @@ void Program::fill_ndarray_fast(Ndarray *ndarray, uint32_t val) {
}

Program::~Program() {
if (!finalized_)
finalize();
finalize();
}

std::unique_ptr<AotModuleBuilder> Program::make_aot_module_builder(Arch arch) {
Expand Down

0 comments on commit 0aa0a17

Please sign in to comment.