forked from FFmpeg/FFmpeg
avfilter/avfiltergraph: Clear graph pointers in ff_filter_graph_remove_filter()
When a filter is no longer part of a graph, its pointers should be cleared so no stale pointers remain. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
2dc954e0bd
commit
281caece46
1 changed files with 6 additions and 1 deletions
|
@ -93,12 +93,17 @@ AVFilterGraph *avfilter_graph_alloc(void)
|
||||||
|
|
||||||
void ff_filter_graph_remove_filter(AVFilterGraph *graph, AVFilterContext *filter)
|
void ff_filter_graph_remove_filter(AVFilterGraph *graph, AVFilterContext *filter)
|
||||||
{
|
{
|
||||||
int i;
|
int i, j;
|
||||||
for (i = 0; i < graph->nb_filters; i++) {
|
for (i = 0; i < graph->nb_filters; i++) {
|
||||||
if (graph->filters[i] == filter) {
|
if (graph->filters[i] == filter) {
|
||||||
FFSWAP(AVFilterContext*, graph->filters[i],
|
FFSWAP(AVFilterContext*, graph->filters[i],
|
||||||
graph->filters[graph->nb_filters - 1]);
|
graph->filters[graph->nb_filters - 1]);
|
||||||
graph->nb_filters--;
|
graph->nb_filters--;
|
||||||
|
filter->graph = NULL;
|
||||||
|
for (j = 0; j<filter->nb_outputs; j++)
|
||||||
|
if (filter->outputs[j])
|
||||||
|
filter->outputs[j]->graph = NULL;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue