mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-07 13:30:03 -05:00
gsettings: check that children haven't been deleted before using them
According to the documentation of g_settings_list_children(), the listed children may be removed at any time, so g_settings_get_child() may return NULL. This is probably very unlikely to happen in practice, but it's good to check anyway.
This commit is contained in:
parent
f5ff5d8bf2
commit
8484b63c18
1 changed files with 8 additions and 2 deletions
|
|
@ -93,8 +93,14 @@ int main(int argc, char *argv[]) {
|
|||
group_names = g_settings_list_children(settings);
|
||||
|
||||
for (name = group_names; *name; name++) {
|
||||
g_signal_connect(g_settings_get_child(settings, *name), "changed",
|
||||
(GCallback) module_group_callback, *name);
|
||||
GSettings *child = g_settings_get_child(settings, *name);
|
||||
|
||||
/* The child may have been removed between the
|
||||
* g_settings_list_children() and g_settings_get_child() calls. */
|
||||
if (!child)
|
||||
continue;
|
||||
|
||||
g_signal_connect(child, "changed", (GCallback) module_group_callback, *name);
|
||||
handle_module_group(*name);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue