rust/hg-cpython/src/dirstate/dirs_multiset.rs
changeset 42850 8f549c46bc64
parent 42849 8db8fa1de2ef
child 42851 64e28b891796
--- a/rust/hg-cpython/src/dirstate/dirs_multiset.rs	Sun Sep 01 17:37:30 2019 +0900
+++ b/rust/hg-cpython/src/dirstate/dirs_multiset.rs	Sun Sep 01 17:48:24 2019 +0900
@@ -86,10 +86,11 @@
             })
     }
     def __iter__(&self) -> PyResult<DirsMultisetKeysIterator> {
+        let (leak_handle, leaked_ref) = self.leak_immutable(py)?;
         DirsMultisetKeysIterator::create_instance(
             py,
-            RefCell::new(Some(DirsMultisetLeakedRef::new(py, &self))),
-            RefCell::new(Box::new(self.leak_immutable(py)?.iter())),
+            RefCell::new(Some(leak_handle)),
+            RefCell::new(Box::new(leaked_ref.iter())),
         )
     }