diff options
author | Andreas Kling <kling@serenityos.org> | 2020-02-16 19:36:15 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-02-16 21:58:17 +0100 |
commit | a6e69bda71440f40d6c9d289258a69c0942b90ba (patch) | |
tree | 7cc2c0f131f0812d020fb4bfc08a097935711f13 /Libraries/LibC/dlfcn.cpp | |
parent | 9794e18a20e026f0a377c8bc90fe5eb9909dae8b (diff) | |
download | serenity-a6e69bda71440f40d6c9d289258a69c0942b90ba.zip |
AK: Add basic Traits for RefPtr
This allows RefPtr to be stored in a HashTable<RefPtr<T>> :^)
It's unfortunate about the const_casts. We'll need to fix HashMap::get
to play nice with non-const Traits<T>::PeekType at some point.
Diffstat (limited to 'Libraries/LibC/dlfcn.cpp')
-rw-r--r-- | Libraries/LibC/dlfcn.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Libraries/LibC/dlfcn.cpp b/Libraries/LibC/dlfcn.cpp index c7bea4b50b..9531511525 100644 --- a/Libraries/LibC/dlfcn.cpp +++ b/Libraries/LibC/dlfcn.cpp @@ -74,8 +74,7 @@ void* dlopen(const char* filename, int flags) auto existing_elf_object = g_elf_objects.get(file_path.basename()); if (existing_elf_object.has_value()) { - void* referenced_object = existing_elf_object.value().leak_ref(); - return referenced_object; + return const_cast<ELFDynamicLoader*>(existing_elf_object.value()); } int fd = open(filename, O_RDONLY); @@ -110,7 +109,7 @@ void* dlopen(const char* filename, int flags) g_dlerror_msg = "Successfully loaded ELF object."; // we have one refcount already - return g_elf_objects.get(file_path.basename()).value().ptr(); + return const_cast<ELFDynamicLoader*>(g_elf_objects.get(file_path.basename()).value()); } void* dlsym(void* handle, const char* symbol_name) |