[ObjCRuntime] Fix a GCHandle leak. (#10981)
Make sure to free the weak GCHandles we create to track NSObjects, just removing them from our dictionary doesn't cut it. Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
This commit is contained in:
Родитель
d0069abd4a
Коммит
4ba01d16f3
|
@ -997,8 +997,10 @@ namespace ObjCRuntime {
|
|||
{
|
||||
lock (lock_obj) {
|
||||
if (object_map.TryGetValue (ptr, out var wr)) {
|
||||
if (managed_obj == null || wr.Target == (object) managed_obj)
|
||||
if (managed_obj == null || wr.Target == (object) managed_obj) {
|
||||
object_map.Remove (ptr);
|
||||
wr.Free ();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче