Skip to content

Commit e2d3ddd

Browse files
authored
Merge pull request #809 from Unity-Technologies/unity-master-debugger-clear-types-for-assembly
Reuse class unload cache filter logic in debugger (case 974228) case 974228 - Fix crash on exit when using script debugger Debugger maintains it's own list of loaded classes. The unload/filter logic does not handle composite types like arrays and generic instances. Expose and reuse the logic from metadata that properly detects any usage of an image within a type. This prevents the cache from containing MonoClass values which have already been freed by the metadata cleaning code.
2 parents 1ad733d + 79f86de commit e2d3ddd

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

mono/metadata/metadata-internals.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -964,5 +964,8 @@ mono_loader_get_strict_strong_names (void);
964964
char*
965965
mono_signature_get_managed_fmt_string (MonoMethodSignature *sig);
966966

967+
gboolean
968+
mono_type_in_image (MonoType *type, MonoImage *image);
969+
967970
#endif /* __MONO_METADATA_INTERNALS_H__ */
968971

mono/metadata/metadata.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2401,6 +2401,12 @@ type_in_image (MonoType *type, MonoImage *image)
24012401
}
24022402
}
24032403

2404+
gboolean
2405+
mono_type_in_image (MonoType *type, MonoImage *image)
2406+
{
2407+
return type_in_image (type, image);
2408+
}
2409+
24042410
static inline void
24052411
image_sets_lock (void)
24062412
{

mono/mini/debugger-agent.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8059,7 +8059,7 @@ clear_event_requests_for_assembly (MonoAssembly *assembly)
80598059
static gboolean
80608060
type_comes_from_assembly (gpointer klass, gpointer also_klass, gpointer assembly)
80618061
{
8062-
return (mono_class_get_image ((MonoClass*)klass) == mono_assembly_get_image ((MonoAssembly*)assembly));
8062+
return mono_type_in_image (mono_class_get_type ((MonoClass*)klass), mono_assembly_get_image ((MonoAssembly*)assembly));
80638063
}
80648064

80658065
/*

0 commit comments

Comments
 (0)