+2009-01-23 Mark Probst <mark.probst@gmail.com>
+
+ Backport of r124022 and r124301.
+
+ * metadata.c (mono_metadata_generic_param_equal): Owner as well as
+ image must match. Only compare the image if the owner is NULL.
+ Fixes the AOT failures.
+
2009-01-23 Zoltan Varga <vargaz@gmail.com>
Backport of r124268.
if (p1->num != p2->num)
return FALSE;
- if (p1->owner == p2->owner)
+ /*
+ * We have to compare the image as well because if we didn't,
+ * the generic_inst_cache lookup wouldn't care about the image
+ * of generic params, so what could happen is that a generic
+ * inst with params from image A is put into the cache, then
+ * image B gets that generic inst from the cache, image A is
+ * unloaded, so the inst is deleted, but image B still retains
+ * a pointer to it.
+ *
+ * The AOT runtime doesn't set the image when it's decoding
+ * types, so we only compare it when the owner is NULL.
+ */
+ if (p1->owner == p2->owner && (p1->owner || p1->image == p2->image))
return TRUE;
/*