File tree Expand file tree Collapse file tree 3 files changed +16
-1
lines changed
Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,9 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
1111 type aliases function the same as the ones they belong to, resolving to either the tracing
1212 versions when debug assertions are enabled or the standard one when they're not.
1313
14+ ### Fixed
15+ - Fixed a corruption error where deallocating a previously cyclic mutex could result in a panic.
16+
1417## [ 0.1.1] - 2021-05-24
1518
1619### Changed
Original file line number Diff line number Diff line change @@ -127,7 +127,7 @@ where
127127 // We use map instead of unwrap to avoid an `unwrap()` but we know that these
128128 // entries are present as we just added them above.
129129 self . nodes . get_mut ( & y) . map ( |node| node. in_edges . remove ( & x) ) ;
130- self . nodes . get_mut ( & x) . map ( |node| node. out_edges . remove ( & x ) ) ;
130+ self . nodes . get_mut ( & x) . map ( |node| node. out_edges . remove ( & y ) ) ;
131131
132132 // No edge was added
133133 return false ;
Original file line number Diff line number Diff line change @@ -304,6 +304,18 @@ mod tests {
304304 assert ! ( get_dependency_graph( ) . add_edge( c. value( ) , a. value( ) ) ) ;
305305 }
306306
307+ /// Test creating a cycle, then panicking.
308+ #[ test]
309+ #[ should_panic]
310+ fn test_mutex_id_conflict ( ) {
311+ let ids = [ MutexId :: new ( ) , MutexId :: new ( ) , MutexId :: new ( ) ] ;
312+
313+ for i in 0 ..3 {
314+ let _first_lock = ids[ i] . get_borrowed ( ) ;
315+ let _second_lock = ids[ ( i + 1 ) % 3 ] . get_borrowed ( ) ;
316+ }
317+ }
318+
307319 /// Fuzz the global dependency graph by fake-acquiring lots of mutexes in a valid order.
308320 ///
309321 /// This test generates all possible forward edges in a 100-node graph consisting of natural
You can’t perform that action at this time.
0 commit comments