From 7f31798119a96090f9e6280f366f1ead311fdbc6 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Tue, 21 Dec 2021 19:33:02 +0000 Subject: [PATCH] Another trace fix. Now it's perfect. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3694 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- src/trace.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/trace.c b/src/trace.c index eafc9945..6a2282d4 100644 --- a/src/trace.c +++ b/src/trace.c @@ -152,7 +152,12 @@ void tf_trace_end(tf_trace_t* trace) { stack = stack->next; } - const char* name = stack && stack->count > 0 ? stack->names[stack->count - 1] : NULL; + const char* name = NULL; + if (stack && stack->count > 0) + { + name = stack->names[stack->count - 1]; + stack->count--; + } char line[1024]; int p = snprintf(line, sizeof(line), "{\"ph\": \"E\", \"pid\": %d, \"tid\": 0, \"ts\": %" PRId64 ", \"name\": \"", getpid(), _trace_ts());