File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -407,13 +407,11 @@ delegate_hash_table_add (MonoDelegateHandle d)
407
407
g_hash_table_insert (delegate_hash_table , delegate_trampoline , gchandle );
408
408
}
409
409
} else {
410
- if (g_hash_table_lookup (delegate_hash_table , delegate_trampoline ) == NULL ) {
411
- MonoGCHandle gchandle = mono_gchandle_from_handle (MONO_HANDLE_CAST (MonoObject , d ), FALSE);
412
- // This delegate will always be associated with its delegate_trampoline in the table.
413
- // We don't free this delegate object because it is too expensive to keep track of these
414
- // pairs and avoid races with the delegate finalization.
415
- g_hash_table_insert (delegate_hash_table , delegate_trampoline , gchandle );
416
- }
410
+ MonoGCHandle gchandle = mono_gchandle_from_handle (MONO_HANDLE_CAST (MonoObject , d ), FALSE);
411
+ // If a delegate already exists with a matching function pointer we assume it's old as
412
+ // we've just jitted a new one and replace it. This is preferred to continuing to run
413
+ // with stale data in the map that could be used later.
414
+ g_hash_table_insert (delegate_hash_table , delegate_trampoline , gchandle );
417
415
}
418
416
mono_marshal_unlock ();
419
417
}
You can’t perform that action at this time.
0 commit comments