dunst-project / dunst

Lightweight and customizable notification daemon
https://dunst-project.org
Other
4.52k stars 338 forks source link

Segmentation fault on Wayland (`ctx.current_buffer` is NULL) #1147

Closed ShellCode33 closed 1 year ago

ShellCode33 commented 1 year ago

Hey, I'm unsure of what triggers the bug exactly, but it seems that the dunst daemon crashes randomly on SwayWM. All notifications are lost.

I may be wrong, but I think it happens when swaylock locks the session.

I tried to reproduce using the following one liner, but it didn't trigger the bug:

swayidle -w timeout 5 swaylock timeout 10 swaymsg "output * power off" resume swaymsg "output * power on" before-sleep swaylock

Here's the backtrace from the coredump:

image

So apparently this is due to the following function:

https://github.com/dunst-project/dunst/blob/7bd8e6b87f06702d8106dc46fb4ed5ffca588bf3/src/wayland/wl.c#L817-L823

It seems to confirm this is somehow related to swaylock, or the outputs being turned off by swaymsg. I'm not familiar with Wayland, but maybe when the outputs are off there's no "surface to draw on" so no current_buffer ? I don't know just a guess.

The segfault is caused by ctx.current_buffer being null:

image

I'm running Dunst 1.9.0 from the ArchLinux repositories.