From 32b7460685f61aceb51703a5727b26575aacb96d Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Mon, 13 Apr 2026 14:20:30 +0300 Subject: fix: detail_window_load must not call set_placeholder_content with self Calling snprintf(buf, n, "%s", buf) is undefined behaviour; Pebble's ARM libc zeroes the buffer, making every placeholder window render blank. Replace the set_placeholder_content call in detail_window_load with direct text_layer_set_text calls since the static buffers are already populated by show_placeholder_window before the window is pushed. Co-Authored-By: Claude Sonnet 4.6 --- src/c/fastforge.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/c/fastforge.c b/src/c/fastforge.c index 7f6c360..578948e 100644 --- a/src/c/fastforge.c +++ b/src/c/fastforge.c @@ -1738,7 +1738,12 @@ static void detail_window_load(Window *window) { add_text_layer(window_layer, s_placeholder_title_layer); add_text_layer(window_layer, s_placeholder_body_layer); add_text_layer(window_layer, s_placeholder_hint_layer); - set_placeholder_content(s_placeholder_title_text, s_placeholder_body_text, s_placeholder_hint_text); + /* Buffers were already filled by show_placeholder_window before the window + * was pushed. Set the layer pointers directly to avoid snprintf(buf, "%s", + * buf) undefined-behaviour (self-copy clears the string on Pebble's libc). */ + text_layer_set_text(s_placeholder_title_layer, s_placeholder_title_text); + text_layer_set_text(s_placeholder_body_layer, s_placeholder_body_text); + text_layer_set_text(s_placeholder_hint_layer, s_placeholder_hint_text); } static void detail_window_unload(Window *window) { -- cgit v1.2.3