Fix menu-actions GTK callback pointer handling#4925
Conversation
2c2f6f9 to
69b3e5e
Compare
69b3e5e to
3cfb622
Compare
"could" in what case exactly? This is the constructor and |
|
The intention here was to be defensive about the data passed to the GTK callback. While menuActionsMap_ does persist for the lifetime of the object, relying on implicit lifetime guarantees can be fragile depending on how the code evolves. The change was aimed at making the ownership explicit and avoiding potential issues if the storage pattern changes in the future. That said, I understand your point regarding the current implementation. |
Fix pointer lifetime handling for menu-actions GTK callbacks.
The previous implementation passed a temporary pointer (
c_str()) to the GTK callback, which could become invalid after the function scope ended.This patch ensures the pointer remains valid by allocating a copy of the string using
g_strdup, providing a stable memory reference for the callback.Verified build locally and tested with Waybar.