Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/managers/HookSystemManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ void CHookSystemManager::emit(std::vector<SCallbackFNPtr>* const callbacks, SCal
continue;

try {
m_hookFaultJumpBufReady = true;
if (!setjmp(m_hookFaultJumpBuf)) {
if (SP<HOOK_CALLBACK_FN> fn = cb.fn.lock())
(*fn)(fn.get(), info, data);
Expand All @@ -63,7 +64,11 @@ void CHookSystemManager::emit(std::vector<SCallbackFNPtr>* const callbacks, SCal
// TODO: this works only once...?
faultyHandles.push_back(cb.handle);
Debug::log(ERR, "[hookSystem] Hook from plugin {:x} caused a SIGSEGV, queueing for unloading.", rc<uintptr_t>(cb.handle));
} catch (...) {
faultyHandles.push_back(cb.handle);
Debug::log(ERR, "[hookSystem] Hook from plugin {:x} caused an unknown fault, queueing for unloading.", rc<uintptr_t>(cb.handle));
}
m_hookFaultJumpBufReady = false;
}

if (needsDeadCleanup)
Expand Down
1 change: 1 addition & 0 deletions src/managers/HookSystemManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class CHookSystemManager {
std::vector<SCallbackFNPtr>* getVecForEvent(const std::string& event);

bool m_currentEventPlugin = false;
bool m_hookFaultJumpBufReady = false;
jmp_buf m_hookFaultJumpBuf;

private:
Expand Down