@@ -726,17 +726,21 @@ inflate_info (MonoRuntimeGenericContextInfoTemplate *oti, MonoGenericContext *co
726726MonoType * t = mono_class_inflate_generic_type_checked (m_class_get_byval_arg (dele_info -> klass ), context , error );
727727mono_error_assert_msg_ok (error , "Could not inflate generic type" ); /* FIXME proper error handling */
728728
729- MonoClass * klass = mono_class_from_mono_type_internal (t );
729+ MonoClass * inflated_klass = mono_class_from_mono_type_internal (t );
730730mono_metadata_free_type (t );
731731
732732MonoMethod * method = mono_class_inflate_generic_method_checked (dele_info -> method , context , error );
733733mono_error_assert_msg_ok (error , "Could not inflate generic method" ); /* FIXME proper error handling */
734734
735- // FIXME: Temporary
736- MonoDelegateClassMethodPair * res = (MonoDelegateClassMethodPair * )mono_domain_alloc0 (domain , sizeof (MonoDelegateClassMethodPair ));
735+ MonoDelegateClassMethodPair * res = NULL ;
736+ if (temporary )
737+ res = (MonoDelegateClassMethodPair * )g_malloc0 (sizeof (MonoDelegateClassMethodPair ));
738+ else
739+ res = (MonoDelegateClassMethodPair * )mono_image_alloc0 (m_class_get_image (klass ), sizeof (MonoDelegateClassMethodPair ));
740+
737741res -> is_virtual = dele_info -> is_virtual ;
738742res -> method = method ;
739- res -> klass = klass ;
743+ res -> klass = inflated_klass ;
740744return res ;
741745
742746}
@@ -763,6 +767,9 @@ free_inflated_info (MonoRgctxInfoType info_type, gpointer info)
763767case MONO_RGCTX_INFO_CAST_CACHE :
764768mono_metadata_free_type ((MonoType * )info );
765769break ;
770+ case MONO_RGCTX_INFO_DELEGATE_TRAMP_INFO :
771+ g_free (info );
772+ break ;
766773default :
767774break ;
768775}
0 commit comments