kolunmi / dwlb

Feature-Complete Bar for DWL
Other
60 stars 20 forks source link

dwlb crashes when an output is disconnected #39

Closed DhruvaSambrani closed 4 months ago

DhruvaSambrani commented 8 months ago

Title

Kuchteq commented 8 months ago

I can confirm on the newest dwl commit 26d7c9689f6e7eb699f2a63c2093c2a27e411ea3 Perhaps it was the update to newer wlroots that causes it.

jakubgrad commented 7 months ago

I had the same issue until I downgraded wlroots to 17.0.1. Before, dwlb would crash and occassionally UI would freeze

Kuchteq commented 7 months ago

I think the bug is caused by this wlroots commit: https://gitlab.freedesktop.org/wlroots/wlroots/-/commit/6d13d1814e019b11ea5dc07261e505373a277cb6

I did some debugging and turns out that before wlroots 17.1.0 the event:

static void
layer_surface_closed(void *data, struct zwlr_layer_surface_v1 *surface)
{
    run_display = false;
}

never got ran when unplugging the display. After the aforementioned commit, this event started getting ran. This run_display variable later gets checked in the event_loop() and once it gets set to false, dwlb proceeds to finish its execution and exits regularly. I'm not 100% sure of the usage of the run_display variable throughout the whole codebase but as a quick hack, you can just comment out the run_display = false part and have it work as is. From what I've seen, everything is already torn down within handle_global_remove when the display gets disconnected so all is good. If there will be no comments about this I could submit a quick pr like this.

kolunmi commented 7 months ago

Thanks for reporting this!

@Kuchteq please do submit a pr

kolunmi commented 4 months ago

fixed in #41