nyyManni / dmenu-wayland

dmenu for wayland-compositors
MIT License
197 stars 22 forks source link

Dmenu-wl crashes with mmap failed, but not dmenu #24

Open jthulhu opened 3 years ago

jthulhu commented 3 years ago

When executing dmenu-wl with some input, it crashes with mmap failed: Invalid argument. However, this is not the case of dmenu, which runs fine.

I read the documentation of mmap, and it may fail with this error code when len is 0. I have probably located the mmap call that crashes. It's in draw.c, and len corresponds to size, which is (I suppose) the size of the menu to be drawn. This size is computed with informations that come from monitors. Thus, I suppose the problem might come from the fact that dmenu achieves to retrieve information about the monitors, but not dmenu-wl (which is strange if you ask me, why the version made for xorg should work on wayland, but not the version made for wayland...). Hope it helps.

keithbowes commented 2 years ago

I suppose that depends on your compositor. WFM.

jthulhu commented 2 years ago

That was quite some time ago, I don't remember which compositor I used then (probably Gnome or Sway). Anyways, now it works for me too (currently using Sway).

rakusan2 commented 2 years ago

I am using Mutter and I have found that monitor->logical_width is used before being set thereby causing factor and width in dmenu_create_buffer to be 0

rakusan2 commented 2 years ago

At least for me (Mutter v42.0) the bug looks to stem from in handle_global() panel->display_info.xdg_output_manager never being anything other than 0

rakusan2 commented 2 years ago

panel->display_info.xdg_output_manager is set in a later call to handle_global than monitors