From 42d6636ae7884b1b6858d7f76ee55f0aed69a9a6 Mon Sep 17 00:00:00 2001 From: Giovanni Bajo Date: Thu, 14 Nov 2024 11:57:36 +0100 Subject: [PATCH] rdpq_debug: allow calling rdpq_debug_log without rdpq_debug_start --- src/rdpq/rdpq_debug.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/rdpq/rdpq_debug.c b/src/rdpq/rdpq_debug.c index 8785429a1..e3ee19771 100644 --- a/src/rdpq/rdpq_debug.c +++ b/src/rdpq/rdpq_debug.c @@ -381,8 +381,13 @@ void rdpq_debug_start(void) void rdpq_debug_log(bool log) { - assertf(rdpq_trace, "rdpq trace engine not started"); - rdpq_passthrough_write((RDPQ_CMD_DEBUG, RDPQ_CMD_DEBUG_SHOWLOG, log ? 1 : 0)); + static bool warning = false; + if (log && !rdpq_trace && !warning) { + debugf("WARNING: rdpq_debug_log(true) ignored because trace engine was not started\n"); + warning = true; + } + if (rdpq_trace) + rdpq_passthrough_write((RDPQ_CMD_DEBUG, RDPQ_CMD_DEBUG_SHOWLOG, log ? 1 : 0)); } void rdpq_debug_log_msg(const char *msg)