diff --git a/incremental/compat/src/arkts/finalization.ts b/incremental/compat/src/arkts/finalization.ts index ff4293d03e9fa9da7fc3bb89e70aee1f8452dcda..021bc1d43f17c58b07110041d506202183097f1f 100644 --- a/incremental/compat/src/arkts/finalization.ts +++ b/incremental/compat/src/arkts/finalization.ts @@ -15,22 +15,17 @@ */ export interface Thunk { - // TODO uncomment and use as soon as the FinalizationRegistry is in the sdk - // clean(): void + clean(): void } -/* -const registry = new FinalizationQueue((thunk: Thunk) => { +const registry = new FinalizationRegistry((thunk: Thunk) => { thunk.clean() }) -*/ export function finalizerRegister(target: Object, thunk: Object) { - console.log("finalizerRegister") - // registry.register(target, thunk) + registry.register(target, thunk as Thunk) } export function finalizerUnregister(target: Object) { - console.log("finalizerUnregister") - // registry.unregister(target) + registry.unregister(target) } diff --git a/interop/src/cpp/vmloader.cc b/interop/src/cpp/vmloader.cc index 56cdac2b57ecd6eefd9293da0df88d69d0fd19aa..5a13ab166da22fd98618a14ec076789ffe647284 100644 --- a/interop/src/cpp/vmloader.cc +++ b/interop/src/cpp/vmloader.cc @@ -527,8 +527,8 @@ void traverseDir(std::string root, std::vector& paths, int depth) { #if defined(KOALA_OHOS) suffix += ".so"; #endif - DIR* d = opendir(root.c_str()); - if (!d) { + DIR* directory = opendir(root.c_str()); + if (!directory) { LOGE("Cannot open dir %" LOG_PUBLIC "s\n", root.c_str()); return; } @@ -536,7 +536,7 @@ void traverseDir(std::string root, std::vector& paths, int depth) { struct stat statbuf; LOGI("Searching for *%" LOG_PUBLIC "s in %" LOG_PUBLIC "s\n", suffix.c_str(), root.c_str()); - while ((ent = readdir(d)) != nullptr) { + while ((ent = readdir(directory)) != nullptr) { std::string filename = std::string(ent->d_name); if (filename == "." || filename == "..") { continue; @@ -551,5 +551,6 @@ void traverseDir(std::string root, std::vector& paths, int depth) { traverseDir(filepath, paths, depth + 1); } } + closedir(directory); #endif }