Author: zoltan
Date: 2007-08-24 14:39:57 -0400 (Fri, 24 Aug 2007)
New Revision: 84815
Modified:
trunk/mono/mono/metadata/ChangeLog
trunk/mono/mono/metadata/assembly.c
trunk/mono/mono/metadata/image.c
Log:
2007-08-24 Zoltan Varga <[EMAIL PROTECTED]>
* assembly.c (mono_assembly_close): Move the closing of the referenced
assemblies to
...
* image.c (mono_image_close): Here. Hopefully fixes #82510.
Modified: trunk/mono/mono/metadata/ChangeLog
===================================================================
--- trunk/mono/mono/metadata/ChangeLog 2007-08-24 17:19:41 UTC (rev 84814)
+++ trunk/mono/mono/metadata/ChangeLog 2007-08-24 18:39:57 UTC (rev 84815)
@@ -1,3 +1,10 @@
+2007-08-24 Zoltan Varga <[EMAIL PROTECTED]>
+
+ * assembly.c (mono_assembly_close): Move the closing of the referenced
assemblies to
+ ...
+
+ * image.c (mono_image_close): Here. Hopefully fixes #82510.
+
2007-08-24 Mark Probst <[EMAIL PROTECTED]>
* monodiet.c (handle_cattrs): Fixed a custom attr leak.
Modified: trunk/mono/mono/metadata/assembly.c
===================================================================
--- trunk/mono/mono/metadata/assembly.c 2007-08-24 17:19:41 UTC (rev 84814)
+++ trunk/mono/mono/metadata/assembly.c 2007-08-24 18:39:57 UTC (rev 84815)
@@ -2339,18 +2339,6 @@
loaded_assemblies = g_list_remove (loaded_assemblies, assembly);
mono_assemblies_unlock ();
- if (assembly->image->references) {
- int i;
-
- for (i = 0; assembly->image->references [i]; i++) {
- if (assembly->image->references [i])
- mono_assembly_close
(assembly->image->references [i]);
- }
-
- g_free (assembly->image->references);
- assembly->image->references = NULL;
- }
-
assembly->image->assembly = NULL;
mono_image_close (assembly->image);
Modified: trunk/mono/mono/metadata/image.c
===================================================================
--- trunk/mono/mono/metadata/image.c 2007-08-24 17:19:41 UTC (rev 84814)
+++ trunk/mono/mono/metadata/image.c 2007-08-24 18:39:57 UTC (rev 84815)
@@ -27,6 +27,7 @@
#include <mono/utils/mono-logger.h>
#include <mono/utils/mono-path.h>
#include <mono/metadata/class-internals.h>
+#include <mono/metadata/assembly.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
@@ -1104,6 +1105,23 @@
mono_metadata_clean_for_image (image);
+ /*
+ * The caches inside a MonoImage might refer to metadata which is
stored in referenced
+ * assemblies, so we can't release these references in
mono_assembly_close () since the
+ * MonoImage might outlive its associated MonoAssembly.
+ */
+ if (image->references) {
+ int i;
+
+ for (i = 0; image->references [i]; i++) {
+ if (image->references [i])
+ mono_assembly_close (image->references [i]);
+ }
+
+ g_free (image->references);
+ image->references = NULL;
+ }
+
mono_images_lock ();
loaded_images = image->ref_only ? loaded_images_refonly_hash :
loaded_images_hash;
loaded_images_guid = image->ref_only ? loaded_images_refonly_guid_hash
: loaded_images_guid_hash;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches