Merge "replace dlclose() with CloseNativeLibrary() in vulkan layer" am: 7101abd148
am: 553065f3cb
Change-Id: I8663dbd8c0740780d19dd0f826c9216009231bb1
diff --git a/vulkan/libvulkan/layers_extensions.cpp b/vulkan/libvulkan/layers_extensions.cpp
index 96c5563..b32977a 100644
--- a/vulkan/libvulkan/layers_extensions.cpp
+++ b/vulkan/libvulkan/layers_extensions.cpp
@@ -165,8 +165,13 @@
std::lock_guard<std::mutex> lock(mutex_);
if (--refcount_ == 0) {
ALOGV("closing layer library '%s'", path_.c_str());
- dlclose(dlhandle_);
- dlhandle_ = nullptr;
+ std::string error_msg;
+ if (!android::CloseNativeLibrary(dlhandle_, native_bridge_, &error_msg)) {
+ ALOGE("failed to unload library '%s': %s", path_.c_str(), error_msg.c_str());
+ refcount_++;
+ } else {
+ dlhandle_ = nullptr;
+ }
}
}