mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
Hold hooking lock for a shorter time to avoid deadlocks
* In particular, we don't want to hold this lock while potentially calling FreeLibrary as that could try to acquire the loader lock that another thread might be holding while waiting on our lock.
This commit is contained in:
@@ -296,9 +296,12 @@ struct CachedHookData
|
||||
if(found != hookset->FunctionHooks.end() &&
|
||||
!strcmp(found->function.c_str(), importName) && found->excludeModule != module)
|
||||
{
|
||||
SCOPED_LOCK(lock);
|
||||
bool already = false;
|
||||
bool applied = found->ApplyHook(IATentry, already);
|
||||
bool applied;
|
||||
{
|
||||
SCOPED_LOCK(lock);
|
||||
applied = found->ApplyHook(IATentry, already);
|
||||
}
|
||||
|
||||
// if we failed, or if it's already set and we're not doing a missedOrdinals
|
||||
// second pass, then just bail out immediately as we've already hooked this
|
||||
@@ -344,9 +347,12 @@ struct CachedHookData
|
||||
if(found != hookset->FunctionHooks.end() &&
|
||||
!strcmp(found->function.c_str(), importName) && found->excludeModule != module)
|
||||
{
|
||||
SCOPED_LOCK(lock);
|
||||
bool already = false;
|
||||
bool applied = found->ApplyHook(IATentry, already);
|
||||
bool applied;
|
||||
{
|
||||
SCOPED_LOCK(lock);
|
||||
applied = found->ApplyHook(IATentry, already);
|
||||
}
|
||||
|
||||
// if we failed, or if it's already set and we're not doing a missedOrdinals
|
||||
// second pass, then just bail out immediately as we've already hooked this
|
||||
|
||||
Reference in New Issue
Block a user