sources: reselect earlier when removing selected source
When a selected source is being removed, reset the instance and rerun the selection while the source is still marked as selected. This forces a "Can't synchronise" message to be logged when all sources are removed. Reported-by: Thomas Lange <thomas@corelatus.se>
This commit is contained in:
parent
cbee464c75
commit
5dd288dc0c
1 changed files with 5 additions and 4 deletions
|
@ -314,8 +314,12 @@ void SRC_DestroyInstance(SRC_Instance instance)
|
||||||
if (last_updated_inst == instance)
|
if (last_updated_inst == instance)
|
||||||
last_updated_inst = NULL;
|
last_updated_inst = NULL;
|
||||||
|
|
||||||
|
/* Force reselection if currently selected */
|
||||||
|
SRC_ResetInstance(instance);
|
||||||
|
|
||||||
assert(initialised);
|
assert(initialised);
|
||||||
if (instance->index < 0 || instance->index >= n_sources ||
|
if (instance->index < 0 || instance->index >= n_sources ||
|
||||||
|
instance->index == selected_source_index ||
|
||||||
instance != sources[instance->index])
|
instance != sources[instance->index])
|
||||||
assert(0);
|
assert(0);
|
||||||
|
|
||||||
|
@ -330,10 +334,7 @@ void SRC_DestroyInstance(SRC_Instance instance)
|
||||||
|
|
||||||
update_sel_options();
|
update_sel_options();
|
||||||
|
|
||||||
/* If this was the previous reference source, we have to reselect! */
|
if (selected_source_index > dead_index)
|
||||||
if (selected_source_index == dead_index)
|
|
||||||
SRC_ReselectSource();
|
|
||||||
else if (selected_source_index > dead_index)
|
|
||||||
--selected_source_index;
|
--selected_source_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue