Flush GraphNode RCU when removing Routes

Since 44610c787 RCU keeps references until another write happens.
even before then, some shared_ptr references may have been kept.

When using a process graph, a route's activision-set can
hold references to other graph-nodes (routes). This lead
to Routes not being deleted until a second graph-reorder
flushed the RCU.
This commit is contained in:
Robin Gareus 2024-04-25 18:26:50 +02:00
parent 97becda83a
commit 848832f8b0
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
3 changed files with 16 additions and 2 deletions

View File

@ -60,6 +60,7 @@ public:
node_set_t const& activation_set (GraphChain const* const g) const;
int init_refcount (GraphChain const* const g) const;
void flush_graph_activision_rcu ();
protected:
friend struct GraphChain;

View File

@ -46,6 +46,12 @@ GraphActivision::init_refcount (GraphChain const* const g) const
return m->at (g);
}
void
GraphActivision::flush_graph_activision_rcu ()
{
_activation_set.flush ();
}
/* ****************************************************************************/
GraphNode::GraphNode (std::shared_ptr<Graph> graph)

View File

@ -3849,12 +3849,10 @@ Session::remove_routes (std::shared_ptr<RouteList> routes_to_remove)
* going away, then flush old references out of the graph.
*/
routes.flush (); // maybe unsafe, see below.
resort_routes ();
/* get rid of it from the dead wood collection in the route list manager */
/* XXX i think this is unsafe as it currently stands, but i am not sure. (pd, october 2nd, 2006) */
routes.flush ();
/* remove these routes from the selection if appropriate, and signal
@ -3882,6 +3880,15 @@ Session::remove_routes (std::shared_ptr<RouteList> routes_to_remove)
return;
}
/* really drop reference to the Surround Master to
* unload the vapor plugin. While the RCU keeps a refecent the
* SurroundMaster, a new SurroundMaster cannot be added.
*/
std::shared_ptr<RouteList const> r = routes.reader ();
for (auto const& rt : *r) {
rt->flush_graph_activision_rcu ();
}
PropertyChange pc;
pc.add (Properties::order);
PresentationInfo::Change (pc);