summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/native_library.h1
-rw-r--r--base/native_library_mac.mm8
2 files changed, 7 insertions, 2 deletions
diff --git a/base/native_library.h b/base/native_library.h
index 182b3ed..c37e3a4 100644
--- a/base/native_library.h
+++ b/base/native_library.h
@@ -38,6 +38,7 @@ enum NativeLibraryType {
};
struct NativeLibraryStruct {
NativeLibraryType type;
+ CFBundleRefNum bundle_resource_ref;
union {
CFBundleRef bundle;
void* dylib;
diff --git a/base/native_library_mac.mm b/base/native_library_mac.mm
index 63ac9df..8aaeeb1 100644
--- a/base/native_library_mac.mm
+++ b/base/native_library_mac.mm
@@ -40,15 +40,19 @@ NativeLibrary LoadNativeLibrary(const FilePath& library_path) {
NativeLibrary native_lib = new NativeLibraryStruct();
native_lib->type = BUNDLE;
native_lib->bundle = bundle;
+ native_lib->bundle_resource_ref = CFBundleOpenBundleResourceMap(bundle);
return native_lib;
}
// static
void UnloadNativeLibrary(NativeLibrary library) {
- if (library->type == BUNDLE)
+ if (library->type == BUNDLE) {
+ CFBundleCloseBundleResourceMap(library->bundle,
+ library->bundle_resource_ref);
CFRelease(library->bundle);
- else
+ } else {
dlclose(library->dylib);
+ }
delete library;
}