mirror of
https://github.com/labwc/labwc.git
synced 2025-11-07 13:30:06 -05:00
src/ssd/ssd_part.c: ensure button is found
This fixes an issue detected by the static analyzer. It currently is not a real bug but it could become one in the future if `add_toggled_icon()` is called before `add_scene_button()`. Rather than having `add_toggled_icon()` go through the list, find the root button and then fetch its node descriptor just supply the button as argument.
This commit is contained in:
parent
b959e23d6d
commit
59c95ceb26
3 changed files with 13 additions and 10 deletions
|
|
@ -194,12 +194,10 @@ add_scene_button(struct wl_list *part_list, enum ssd_part_type type,
|
|||
}
|
||||
|
||||
void
|
||||
add_toggled_icon(struct wl_list *part_list, enum ssd_part_type type,
|
||||
struct wlr_buffer *icon_buffer, struct wlr_buffer *hover_buffer)
|
||||
add_toggled_icon(struct ssd_button *button, struct wl_list *part_list,
|
||||
enum ssd_part_type type, struct wlr_buffer *icon_buffer,
|
||||
struct wlr_buffer *hover_buffer)
|
||||
{
|
||||
struct ssd_part *part = ssd_get_part(part_list, type);
|
||||
struct ssd_button *button = node_ssd_button_from_node(part->node);
|
||||
|
||||
/* Alternate icon */
|
||||
struct wlr_box icon_geo = get_scale_box(icon_buffer,
|
||||
SSD_BUTTON_WIDTH, rc.theme->title_height);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue