Commit 89d33990 authored by Harald Sitter's avatar Harald Sitter 🏳️‍🌈
Browse files

don't crash when the server doesn't respond

inside libpulse a non-reply (e.g. caused by a timeout) results in info
being a nullptr. when that happens simply skip over the callback. when
this happens chances are the server crashed or is otherwise defunct so
we won't be able to do much about this anyway

easy to test by attaching to both plasmashell and pulseaudio and
interrupting the latter when the former calls
pa_context_get_server_info. this results in the reply timeout getting
hit -> nullptr callback.

it is unclear if we can somehow recover from this but in lieu of a
reliable real world test case for this we at least shouldn't crash on
nullptr access.

BUG: 454647
BUG: 437272


(cherry picked from commit e87f2b13)
parent 741f6fd4
Pipeline #246256 passed with stage
in 46 seconds
......@@ -149,6 +149,12 @@ static void server_cb(pa_context *context, const pa_server_info *info, void *dat
{
Q_ASSERT(context);
Q_ASSERT(data);
if (!info) {
// info may be nullptr when e.g. the server doesn't reply in time (e.g. it is stuck)
// https://bugs.kde.org/show_bug.cgi?id=454647
qCWarning(PLASMAPA) << "server_cb() called without info!";
return;
}
((Context *)data)->serverCallback(info);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment