all repos — tint2 @ 03b86f5f2c84c35acbc806699c834e1944992f18

fork of the tint2 desktop panel for my custom setup - only minimized windows across all desktops for the taskbar

Merge branch 'big_icon_crash' into 'master'

Fix crashing when a window icon is large

See merge request o9000/tint2!35
Chris chrlee@protonmail.com
commit

03b86f5f2c84c35acbc806699c834e1944992f18

parent

b56147efb7418086912bed90cd5141a1e728732f

1 files changed, 10 insertions(+), 4 deletions(-)

jump to
M src/taskbar/task.csrc/taskbar/task.c

@@ -312,10 +312,16 @@ // get ARGB icon

int w, h; gulong *tmp_data = get_best_icon(data, get_icon_count(data, len), len, &w, &h, icon_size); if (tmp_data) { - DATA32 icon_data[w * h]; - for (int j = 0; j < w * h; ++j) - icon_data[j] = tmp_data[j]; - img = imlib_create_image_using_copied_data(w, h, icon_data); + int array_size = w * h; + // imlib needs the array in DATA32 type + // using malloc for the array to protect from stack overflow + DATA32 *icon_data = (DATA32*) g_try_malloc(sizeof(*icon_data) * array_size); + if (icon_data) { + for (int j = 0; j < array_size; ++j) + icon_data[j] = tmp_data[j]; + img = imlib_create_image_using_copied_data(w, h, icon_data); + g_free(icon_data); + } } } XFree(data);