mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-29 05:40:23 -04:00
module-gsettings: Handle I/O hangup
When child `gsettings-helper` terminates prematurely, unconditionally reading from child pipe fails in a busy loop until child process is reaped. Fix this by terminating module upon PA_IO_EVENT_HANGUP or PA_IO_EVENT_ERROR. Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/600>
This commit is contained in:
parent
7580ef31a1
commit
0555d4f5a5
2 changed files with 15 additions and 9 deletions
|
|
@ -64,7 +64,7 @@ int pa__init(pa_module*m) {
|
|||
u->io_event = m->core->mainloop->io_new(
|
||||
m->core->mainloop,
|
||||
u->fd,
|
||||
PA_IO_EVENT_INPUT,
|
||||
PA_IO_EVENT_INPUT | PA_IO_EVENT_HANGUP | PA_IO_EVENT_ERROR,
|
||||
io_event_cb,
|
||||
u);
|
||||
|
||||
|
|
|
|||
|
|
@ -267,13 +267,19 @@ void io_event_cb(
|
|||
|
||||
struct userdata *u = userdata;
|
||||
|
||||
if (handle_event(u) < 0) {
|
||||
|
||||
if (u->io_event) {
|
||||
u->core->mainloop->io_free(u->io_event);
|
||||
u->io_event = NULL;
|
||||
}
|
||||
|
||||
pa_module_unload_request(u->module, true);
|
||||
if (events & (PA_IO_EVENT_HANGUP|PA_IO_EVENT_ERROR)) {
|
||||
pa_log("Lost I/O connection in module \"%s\"", u->module->name);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (handle_event(u) >= 0)
|
||||
return;
|
||||
|
||||
fail:
|
||||
if (u->io_event) {
|
||||
u->core->mainloop->io_free(u->io_event);
|
||||
u->io_event = NULL;
|
||||
}
|
||||
|
||||
pa_module_unload_request(u->module, true);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue