[reflection] Use coop handles for MonoMethod icalls (#4272)
[mono.git] / mono / metadata / file-io.c
index 5f1ce7efe4738f0e4a5c01878c1a845e09bc0b36..44fde40538cec2ac87acaa2d8a4f9468bc492daa 100644 (file)
@@ -475,7 +475,7 @@ ves_icall_System_IO_MonoIO_FindFirstFile (MonoString *path_with_pattern, MonoStr
                return hnd;
        }
 
-       *file_name = mono_string_from_utf16_checked (data.cFileName, &error);
+       mono_gc_wbarrier_generic_store (file_name, (MonoObject*) mono_string_from_utf16_checked (data.cFileName, &error));
        mono_error_set_pending_exception (&error);
 
        *file_attr = data.dwFileAttributes;
@@ -500,7 +500,7 @@ ves_icall_System_IO_MonoIO_FindNextFile (HANDLE hnd, MonoString **file_name, gin
                return res;
        }
 
-       *file_name = mono_string_from_utf16_checked (data.cFileName, &error);
+       mono_gc_wbarrier_generic_store (file_name, (MonoObject*) mono_string_from_utf16_checked (data.cFileName, &error));
        mono_error_set_pending_exception (&error);
 
        *file_attr = data.dwFileAttributes;