Skip to content

Commit 2b28737

Browse files
committed
Disable instance pointer removal, and reënable caching pointer instances at the first opportunity
1 parent e3dda30 commit 2b28737

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

templates/BindingsTemplate.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ public class Bindings {
268268
let key = instance.globalInstanceNumber
269269
let pointer = UnsafeMutableRawPointer(bitPattern: key)!
270270
// don't automatically cache the trait instance
271-
// Self.nativelyExposedInstances[instance.globalInstanceNumber] = instance
271+
Self.nativelyExposedInstances[instance.globalInstanceNumber] = instance
272272
return pointer
273273
}
274274

@@ -289,20 +289,22 @@ public class Bindings {
289289
if referenceCount == 0 {
290290
print("Uncaching global instance \(key)")
291291
// TODO: fix counting
292-
Self.nativelyExposedInstances.removeValue(forKey: key)
293-
instance.pointerDebugDescription = nil
292+
// Self.nativelyExposedInstances.removeValue(forKey: key)
293+
// instance.pointerDebugDescription = nil
294294
} else if referenceCount < 0 {
295295
print("Bad uncache: negative reference count (\(referenceCount)) for instance \(key)!", severity: .ERROR)
296296
}
297297
return true
298298
}
299299

300+
/*
300301
public class func clearInstancePointers() {
301302
for (_, currentInstance) in Self.nativelyExposedInstances {
302303
currentInstance.pointerDebugDescription = nil
303304
}
304305
Self.nativelyExposedInstances.removeAll()
305306
}
307+
*/
306308

307309
/* SWIFT_TO_RUST_START */
308310
public class func new_LDKTransactionWrapper(array: [UInt8]) -> LDKTransactionWrapper {

0 commit comments

Comments
 (0)