diff options
| author | Paul Buetow <paul@buetow.org> | 2026-04-13 14:20:30 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-04-13 14:20:30 +0300 |
| commit | 32b7460685f61aceb51703a5727b26575aacb96d (patch) | |
| tree | 5b9fa04be33bfcc7f378edb970d38589be2b03a0 /src | |
| parent | 44b54fd8ccf4b9ae0a7e459b446fe183b534292b (diff) | |
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 <noreply@anthropic.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/c/fastforge.c | 7 |
1 files changed, 6 insertions, 1 deletions
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) { |
