[runtime] Pass value callbacks to free values when creating the 'gchandle_hash' dictionary. (#13109)

This way the values are actually freed.
This commit is contained in:
Rolf Bjarne Kvinge 2021-10-26 08:28:03 +02:00 коммит произвёл GitHub
Родитель 00ea033536
Коммит fad9779840
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -834,9 +834,9 @@ xamarin_set_gchandle_trampoline (id self, SEL sel, GCHandle gc_handle, enum Xama
pthread_mutex_lock (&gchandle_hash_lock);
if (gchandle_hash == NULL) {
CFDictionaryValueCallBacks value_callbacks;
CFDictionaryValueCallBacks value_callbacks = { 0 };
value_callbacks.release = release_gchandle_dictionary_entry;
gchandle_hash = CFDictionaryCreateMutable (kCFAllocatorDefault, 0, NULL, NULL);
gchandle_hash = CFDictionaryCreateMutable (kCFAllocatorDefault, 0, NULL, &value_callbacks);
}
if (gc_handle == INVALID_GCHANDLE) {
CFDictionaryRemoveValue (gchandle_hash, self);