tudurom / windowchef

Window Chef is a stacking window manager that cooks windows with orders from the Waitron
https://tudorr.ro/software/windowchef/
ISC License
203 stars 14 forks source link

Fix Issue #16 - Segfault for special window types #17

Closed n1kolas closed 7 years ago

n1kolas commented 7 years ago

Hi,

Problem description is here: https://github.com/tudurom/windowchef/issues/16 I thought I give it a try myself.

Basically you get a memory read error when accessing members of "client" in wm.c line 1692, because it can be NULL after the call to setup_window.

After some debugging with gdb I found that client was NULL when the window type is DOCK or TOOLBAR (hence lemonbar causing a crash).

I think the condition check for NULL can be after the setup_window step. This shouldn't fail if find_client already returns NULL.

Anyways, if you have a better fitting solution, let me know.

tudurom commented 7 years ago

Thank you! I will review your pr when I will have time (I'm still a student).

tudurom commented 7 years ago

Ok, I'm not going to merge it because your fix is pretty wrong. The reason why lemonbar was crashing was setup_window that returned NULL if the window wanted to be ignored (lemonbar si one of them). I fixed that in the latest commit.