sources: fix marking of non-preferred selectable sources
When reducing the list of selectable sources to sources with the prefer option, sources before the first preferred source were left with the SRC_OK status, which triggered an assertion failure in the next selection.
This commit is contained in:
parent
0abdc2a350
commit
4253075a97
1 changed files with 7 additions and 5 deletions
12
sources.c
12
sources.c
|
@ -872,16 +872,18 @@ SRC_SelectSource(SRC_Instance updated_inst)
|
||||||
|
|
||||||
/* If there are any sources with prefer option, reduce the list again
|
/* If there are any sources with prefer option, reduce the list again
|
||||||
only to the preferred sources */
|
only to the preferred sources */
|
||||||
for (i = j = 0; i < n_sel_sources; i++) {
|
for (i = 0; i < n_sel_sources; i++) {
|
||||||
if (sources[sel_sources[i]]->sel_option == SRC_SelectPrefer)
|
if (sources[sel_sources[i]]->sel_option == SRC_SelectPrefer)
|
||||||
sel_sources[j++] = sel_sources[i];
|
break;
|
||||||
}
|
}
|
||||||
|
if (i < n_sel_sources) {
|
||||||
if (j > 0) {
|
for (i = j = 0; i < n_sel_sources; i++) {
|
||||||
for (i = 0; i < n_sel_sources; i++) {
|
|
||||||
if (sources[sel_sources[i]]->sel_option != SRC_SelectPrefer)
|
if (sources[sel_sources[i]]->sel_option != SRC_SelectPrefer)
|
||||||
sources[sel_sources[i]]->status = SRC_NONPREFERRED;
|
sources[sel_sources[i]]->status = SRC_NONPREFERRED;
|
||||||
|
else
|
||||||
|
sel_sources[j++] = sel_sources[i];
|
||||||
}
|
}
|
||||||
|
assert(j > 0);
|
||||||
n_sel_sources = j;
|
n_sel_sources = j;
|
||||||
sel_prefer = 1;
|
sel_prefer = 1;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue