mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
Grab linux library callbacks locally before calling them. Refs #1120
* This should prevent recursive calls from re-processing the same list of callbacks
This commit is contained in:
@@ -100,12 +100,14 @@ static void CheckLoadedLibraries()
|
||||
*hook.orig = dlsym(handle, hook.function.c_str());
|
||||
}
|
||||
|
||||
for(FunctionLoadCallback cb : libraryCallbacks[libName])
|
||||
if(cb)
|
||||
cb(handle);
|
||||
std::vector<FunctionLoadCallback> callbacks;
|
||||
|
||||
// don't call callbacks again if the library is dlopen'd again
|
||||
libraryCallbacks[libName].clear();
|
||||
libraryCallbacks[libName].swap(callbacks);
|
||||
|
||||
for(FunctionLoadCallback cb : callbacks)
|
||||
if(cb)
|
||||
cb(handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -133,12 +135,14 @@ void *intercept_dlopen(const char *filename, int flag, void *ret)
|
||||
*hook.orig = dlsym(ret, hook.function.c_str());
|
||||
}
|
||||
|
||||
for(FunctionLoadCallback cb : libraryCallbacks[libName])
|
||||
if(cb)
|
||||
cb(ret);
|
||||
std::vector<FunctionLoadCallback> callbacks;
|
||||
|
||||
// don't call the callbacks again
|
||||
libraryCallbacks[libName].clear();
|
||||
// don't call callbacks again if the library is dlopen'd again
|
||||
libraryCallbacks[libName].swap(callbacks);
|
||||
|
||||
for(FunctionLoadCallback cb : callbacks)
|
||||
if(cb)
|
||||
cb(handle);
|
||||
|
||||
ret = realdlopen("librenderdoc.so", flag);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user