File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -453,12 +453,16 @@ impl Graph {
453
453
// Nodes are only dropped when they do not have incoming connections.
454
454
// But they may have AudioParams feeding into them, these can de dropped too.
455
455
nodes. retain ( |id, n| {
456
- id. 0 < 2 // never drop Listener and Destination node
457
- || !n
458
- . borrow ( )
459
- . outgoing_edges
460
- . iter ( )
461
- . any ( |e| e. other_id == * index)
456
+ // Check if this node was connected to the dropped node. In that case, it is
457
+ // either an AudioParam (which can be dropped), or the AudioListener that feeds
458
+ // into a PannerNode (which can be disconnected).
459
+ let outgoing_edges = & mut n. borrow_mut ( ) . outgoing_edges ;
460
+ let prev_len = outgoing_edges. len ( ) ;
461
+ outgoing_edges. retain ( |e| e. other_id != * index) ;
462
+ let was_connected = outgoing_edges. len ( ) != prev_len;
463
+
464
+ let special = id. 0 < 2 ; // never drop Listener and Destination node
465
+ special || !was_connected
462
466
} ) ;
463
467
}
464
468
} ) ;
You can’t perform that action at this time.
0 commit comments