Merge pull request #3962 from mkorkalo/fix_MonoBtlsContext_memory_leak
[mono.git] / mono / metadata / object.c
index c25a107fdeb502712987c0c7b5671e8258b1f49d..987ee1045a71db444fb878986592861daab3ac2b 100644 (file)
@@ -1403,7 +1403,8 @@ build_imt_slots (MonoClass *klass, MonoVTable *vt, MonoDomain *domain, gpointer*
 
                mono_class_setup_methods (iface);
                vt_slot = interface_offset;
-               for (method_slot_in_interface = 0; method_slot_in_interface < iface->method.count; method_slot_in_interface++) {
+               int mcount = mono_class_get_method_count (iface);
+               for (method_slot_in_interface = 0; method_slot_in_interface < mcount; method_slot_in_interface++) {
                        MonoMethod *method;
 
                        if (slot_num >= 0 && mono_class_is_ginst (iface)) {
@@ -1438,14 +1439,15 @@ build_imt_slots (MonoClass *klass, MonoVTable *vt, MonoDomain *domain, gpointer*
                for (list_item = extra_interfaces; list_item != NULL; list_item=list_item->next) {
                        MonoClass* iface = (MonoClass *)list_item->data;
                        int method_slot_in_interface;
-                       for (method_slot_in_interface = 0; method_slot_in_interface < iface->method.count; method_slot_in_interface++) {
+                       int mcount = mono_class_get_method_count (iface);
+                       for (method_slot_in_interface = 0; method_slot_in_interface < mcount; method_slot_in_interface++) {
                                MonoMethod *method = mono_class_get_method_by_index (iface, method_slot_in_interface);
 
                                if (method->is_generic)
                                        has_generic_virtual = TRUE;
                                add_imt_builder_entry (imt_builder, method, &imt_collisions_bitmap, interface_offset + method_slot_in_interface, slot_num);
                        }
-                       interface_offset += iface->method.count;
+                       interface_offset += mcount;
                }
        }
        for (i = 0; i < MONO_IMT_SIZE; ++i) {
@@ -6952,6 +6954,12 @@ mono_string_to_utf8_checked (MonoString *s, MonoError *error)
        return as;
 }
 
+char *
+mono_string_handle_to_utf8 (MonoStringHandle s, MonoError *error)
+{
+       return mono_string_to_utf8_checked (MONO_HANDLE_RAW (s), error);
+}
+
 /**
  * mono_string_to_utf8_ignore:
  * @s: a MonoString
@@ -7698,6 +7706,15 @@ mono_object_try_to_string (MonoObject *obj, MonoObject **exc, MonoError *error)
 
 
 
+static char *
+get_native_backtrace (MonoException *exc_raw)
+{
+       HANDLE_FUNCTION_ENTER ();
+       MONO_HANDLE_DCL(MonoException, exc);
+       char * trace = mono_exception_handle_get_native_backtrace (exc);
+       HANDLE_FUNCTION_RETURN_VAL (trace);
+}
+
 /**
  * mono_print_unhandled_exception:
  * @exc: The exception
@@ -7723,7 +7740,7 @@ mono_print_unhandled_exception (MonoObject *exc)
        } else {
                
                if (((MonoException*)exc)->native_trace_ips) {
-                       message = mono_exception_get_native_backtrace ((MonoException*)exc);
+                       message = get_native_backtrace ((MonoException*)exc);
                        free_message = TRUE;
                } else {
                        MonoObject *other_exc = NULL;