Skip to content

Commit

Permalink
Fix compile
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Apr 4, 2024
1 parent 01d3048 commit f760745
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion shared/utility/FunctionHook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ bool FunctionHook::create() {
return false;
}

if (is_valid()) {
if (is_valid_unsafe()) {
return true;
}

Expand Down
8 changes: 6 additions & 2 deletions shared/utility/FunctionHook.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,19 @@ class FunctionHook {

auto is_valid() const {
std::shared_lock _{ m_initialization_mutex };
return m_inline_hook && m_inline_hook->operator bool();
return is_valid_unsafe();
}

FunctionHook& operator=(const FunctionHook& other) = delete;
FunctionHook& operator=(FunctionHook&& other) = delete;

private:
bool is_valid_unsafe() const {
return m_inline_hook && m_inline_hook->operator bool();
}

std::expected<SafetyHookInline, SafetyHookInline::Error> m_inline_hook;
std::shared_mutex m_initialization_mutex{};
mutable std::shared_mutex m_initialization_mutex{};

uintptr_t m_target{ 0 };
uintptr_t m_destination{ 0 };
Expand Down

0 comments on commit f760745

Please sign in to comment.