From 9acc186ceb4bda31f58ce8e641824efabef64dc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Gr=C3=A9goire?= Date: Tue, 13 Jan 2026 11:28:38 +0100 Subject: [PATCH] Don't try to send callstacks of depth 0 (would trigger assert in `tracy::Callstack`) --- public/tracy/TracyLua.hpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/public/tracy/TracyLua.hpp b/public/tracy/TracyLua.hpp index 8f87e5d7..a18e66fa 100644 --- a/public/tracy/TracyLua.hpp +++ b/public/tracy/TracyLua.hpp @@ -206,11 +206,12 @@ static inline int LuaZoneBeginS( lua_State* L ) if( !GetLuaZoneState().active ) return 0; #endif -#ifdef TRACY_CALLSTACK +#if defined TRACY_CALLSTACK && TRACY_CALLSTACK > 0 const uint32_t depth = TRACY_CALLSTACK; #else const auto depth = uint32_t( lua_tointeger( L, 1 ) ); #endif + assert( depth > 0 ); // Would crash later anyway, this is not allowed SendLuaCallstack( L, depth ); lua_Debug dbg; @@ -237,11 +238,12 @@ static inline int LuaZoneBeginNS( lua_State* L ) if( !GetLuaZoneState().active ) return 0; #endif -#ifdef TRACY_CALLSTACK +#if defined TRACY_CALLSTACK && TRACY_CALLSTACK > 0 const uint32_t depth = TRACY_CALLSTACK; #else const auto depth = uint32_t( lua_tointeger( L, 2 ) ); #endif + assert( depth > 0 ); // Would crash later anyway, this is not allowed SendLuaCallstack( L, depth ); lua_Debug dbg; @@ -264,7 +266,7 @@ static inline int LuaZoneBeginNS( lua_State* L ) static inline int LuaZoneBegin( lua_State* L ) { -#if defined TRACY_HAS_CALLSTACK && defined TRACY_CALLSTACK +#if defined TRACY_HAS_CALLSTACK && defined TRACY_CALLSTACK && TRACY_CALLSTACK > 0 return LuaZoneBeginS( L ); #else #ifdef TRACY_ON_DEMAND @@ -291,7 +293,7 @@ static inline int LuaZoneBegin( lua_State* L ) static inline int LuaZoneBeginN( lua_State* L ) { -#if defined TRACY_HAS_CALLSTACK && defined TRACY_CALLSTACK +#if defined TRACY_HAS_CALLSTACK && defined TRACY_CALLSTACK && TRACY_CALLSTACK > 0 return LuaZoneBeginNS( L ); #else #ifdef TRACY_ON_DEMAND