We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ecc09c4 commit 6317b8eCopy full SHA for 6317b8e
1 file changed
tests/userdata.rs
@@ -845,3 +845,21 @@ fn test_userdata_derive() -> Result<()> {
845
846
Ok(())
847
}
848
+
849
+#[test]
850
+fn test_nested_userdata_gc() -> Result<()> {
851
+ let lua = Lua::new();
852
853
+ let counter = Arc::new(());
854
+ let arr = vec![lua.create_any_userdata(counter.clone())?];
855
+ let arr_ud = lua.create_any_userdata(arr)?;
856
857
+ assert_eq!(Arc::strong_count(&counter), 2);
858
+ drop(arr_ud);
859
+ // On first iteration Lua will destroy the array, on second - userdata
860
+ lua.gc_collect()?;
861
862
+ assert_eq!(Arc::strong_count(&counter), 1);
863
864
+ Ok(())
865
+}
0 commit comments