Refactor and fix memory leak in theme_init #6

Manually merged
jabber.developer merged 3 commits from fix/theme-mem-leak into master 2025-06-24 15:37:14 +00:00

3 Commits

Author SHA1 Message Date
d5d5dc5180 ref(theme): ensure clean reinitialization and explicitly initialize static vars
All checks were successful
CI / Check spelling (pull_request) Successful in 17s
CI / Check coding style (pull_request) Successful in 32s
CI / Linux (debian) (pull_request) Successful in 9m44s
CI / Linux (fedora) (pull_request) Successful in 10m40s
CI / Linux (ubuntu) (pull_request) Successful in 12m19s
CI / Linux (arch) (pull_request) Successful in 15m41s
Improves code robustness by calling _theme_close() in theme_init() when the
theme was already initialized, preventing potential memory leaks or
inconsistent state.

Closes #4
2025-06-24 16:22:48 +02:00
83c569de37 ref: Remove unnecessary variable bold_items
The variable was introduced in 976e5aa. First used to detect bold characters, it was later replaced by another solution in 850ac3c.
2025-06-24 15:24:09 +02:00
7d1e1c726d fix: Remove unnecessary theme_init call (mem leak)
Simple `ui_resize` is sufficient for rerendering all the elements.
Other calls create complexity, slow down the applications and even introduce mem leaks.

`ui_resize` technique is already used widely, including `cmd_editor` case.

Fixes #4
2025-06-24 15:10:26 +02:00