]> git.mdlowis.com Git - proto/labwc.git/commit
treewide: properly clear the buffer
authorConsolatis <35009135+Consolatis@users.noreply.github.com>
Sat, 16 Mar 2024 18:03:06 +0000 (19:03 +0100)
committerJohan Malm <johanmalm@users.noreply.github.com>
Thu, 18 Apr 2024 06:00:23 +0000 (07:00 +0100)
commit343918dee06ff76beb49b31ef4861832629011a4
treecee4db78d6ecaf5534cf8f985a549ca948126e16
parentb4f3ffc27e017f71ed338d14ca6953f4d36213dc
treewide: properly clear the buffer

Before this patch, the OSD would repeat the last buffer
content in case the new buffer content would be empty.

This was mostly happening for the `title` OSD field that is intended
to be empty when it matches the app_id / WM_CLASS of the application.
Due to only buffer.len being reset but its internal allocations being
untouched, buffer.buf would still carry the old data.

This patch fixes it by also overwriting the first byte in the buffer
allocation with '\0' via the new `buf_clear()` function.

Do the same for buf_expand_shell_variables() although that one should
have been fine before as it always writes new data to the buffer.
src/common/buf.c
src/osd.c