diff options
author | Timothy Arceri <[email protected]> | 2018-04-13 15:23:57 +1000 |
---|---|---|
committer | Juan A. Suarez Romero <[email protected]> | 2018-04-23 09:56:53 +0000 |
commit | e1b87631a9ea7fd77f3847395157bd57dd4a16eb (patch) | |
tree | f74c1cb0d95a46671944b552c5afad15d48304a2 | |
parent | 279c6285607f2a02b29ed73b98fd20a6829acbde (diff) |
mesa: free debug messages when destroying the debug state
Fixes: 04a8baad3721 "mesa: refactor _mesa_PopDebugGroup and _mesa_free_errors_data"
Reviewed-by: Iago Toral Quiroga <[email protected]>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98281
(cherry picked from commit a63e69f5f0b4d960bd106068d8c7d13b82fea759)
-rw-r--r-- | src/mesa/main/debug_output.c | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/src/mesa/main/debug_output.c b/src/mesa/main/debug_output.c index 859e1f966d2..306ca98fe4f 100644 --- a/src/mesa/main/debug_output.c +++ b/src/mesa/main/debug_output.c @@ -502,6 +502,28 @@ debug_clear_group(struct gl_debug_state *debug) } /** + * Delete the oldest debug messages out of the log. + */ +static void +debug_delete_messages(struct gl_debug_state *debug, int count) +{ + struct gl_debug_log *log = &debug->Log; + + if (count > log->NumMessages) + count = log->NumMessages; + + while (count--) { + struct gl_debug_message *msg = &log->Messages[log->NextMessage]; + + debug_message_clear(msg); + + log->NumMessages--; + log->NextMessage++; + log->NextMessage %= MAX_DEBUG_LOGGED_MESSAGES; + } +} + +/** * Loop through debug group stack tearing down states for * filtering debug messages. Then free debug output state. */ @@ -514,6 +536,7 @@ debug_destroy(struct gl_debug_state *debug) } debug_clear_group(debug); + debug_delete_messages(debug, debug->Log.NumMessages); free(debug); } @@ -648,28 +671,6 @@ debug_fetch_message(const struct gl_debug_state *debug) return (log->NumMessages) ? &log->Messages[log->NextMessage] : NULL; } -/** - * Delete the oldest debug messages out of the log. - */ -static void -debug_delete_messages(struct gl_debug_state *debug, int count) -{ - struct gl_debug_log *log = &debug->Log; - - if (count > log->NumMessages) - count = log->NumMessages; - - while (count--) { - struct gl_debug_message *msg = &log->Messages[log->NextMessage]; - - debug_message_clear(msg); - - log->NumMessages--; - log->NextMessage++; - log->NextMessage %= MAX_DEBUG_LOGGED_MESSAGES; - } -} - static struct gl_debug_message * debug_get_group_message(struct gl_debug_state *debug) { |