wolfpld / tracy

Frame profiler
https://tracy.nereid.pl/
Other
10.24k stars 691 forks source link

Missing lock? #892

Closed jacereda closed 1 month ago

jacereda commented 2 months ago

Shouldn't this if contain a DBGHELP_LOCK/UNLOCK pair?

https://github.com/wolfpld/tracy/blob/be53a82e78fde83db25166e8d4c7a672420da625/public/client/TracyCallstack.cpp#L657

This is what I have locally and looks like it got rid of some crashes:

diff -r bed0a52ae21b tracy/public/client/TracyCallstack.cpp
--- a/tracy/public/client/TracyCallstack.cpp    Tue Sep 24 19:54:14 2024 +0200
+++ b/tracy/public/client/TracyCallstack.cpp    Thu Sep 26 17:48:29 2024 +0200
@@ -451,10 +451,16 @@
     DWORD inlineNum = 0;
     if( _SymAddrIncludeInlineTrace )
     {
+#ifdef TRACY_DBGHELP_LOCK
+            DBGHELP_LOCK;
+#endif
         inlineNum = _SymAddrIncludeInlineTrace( proc, ptr );
         if( inlineNum > MaxCbTrace - 1 ) inlineNum = MaxCbTrace - 1;
         DWORD idx;
         if( inlineNum != 0 ) doInline = _SymQueryInlineTrace( proc, ptr, 0, ptr, ptr, &ctx, &idx );
+#ifdef TRACY_DBGHELP_LOCK
+            DBGHELP_UNLOCK;
+#endif
     }
     if( doInline )
     {
wolfpld commented 2 months ago

How is it going to help? The entire function is already under a lock.

jacereda commented 1 month ago

Oh, right. I'll remove it and try to reproduce the crash. Sorry for the noise.

jacereda commented 1 month ago

And update while I'm at it, I'm lagging several versions behind.