[Mono-devel-list] marshal.c assertion failed.
Scott Mohekey
scott.mohekey at telogis.com
Wed Feb 23 20:01:25 EST 2005
It seems I spoke too soon.
Now I get the following assertion:
Unmanaged code called delegate of type
System.Drawing.GDIPlus/GdiPlusStreamHelper.StreamPutBytesImpl which was
already garbage collected.
See http://www.go-mono.com/delegate.html for an explanation and ways to
fix this.
aborting...
However, I think this could be due to GdiPlusStreamHelper in
gdipFunctions.cs not keeping references to the delegates. I'll check
this now.
Scott.
Scott Mohekey wrote:
> You were spot on Willi. I've attached a patch that corrects this issue.
>
> Scott.
>
> Willibald Krenn wrote:
>
>> Scott Mohekey schrieb:
>>
>>> I've considered this, however in every case the pointer is NOT null.
>>> As far as I can tell, either the lookup code in domain.c for the
>>> jit_info_table is buggy and returns false positives, or another code
>>> path is removing the JitInfo prematurely.
>>
>>
>>
>> Is mono_delegate_free_ftnptr executed within the correct domain? I
>> ask this, because run_finalize (in gc.c) does not set the domain for
>> a call to this function: Being in the wrong domain would also lead to
>> ji not being found.
>>
>> HTH
>> Willi
>>
>> _______________________________________________
>> Mono-devel-list mailing list
>> Mono-devel-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>>
> Index: mono/mono/metadata/gc.c
> ===================================================================
> --- mono/mono/metadata/gc.c (revision 41118)
> +++ mono/mono/metadata/gc.c (working copy)
> @@ -81,8 +81,18 @@
> */
> if (o->vtable->klass->delegate) {
> MonoDelegate* del = (MonoDelegate*)o;
> + MonoDomain* domain = mono_domain_get ();
> +
> + if (domain != o->vtable->domain) {
> + mono_domain_set_internal (o->vtable->domain);
> + }
> +
> if (del->delegate_trampoline)
> mono_delegate_free_ftnptr ((MonoDelegate*)o);
> +
> + if (domain != o->vtable->domain) {
> + mono_domain_set_internal (domain);
> + }
> return;
> }
> if (o->vtable->klass == mono_get_thread_class ())
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
More information about the Mono-devel-list
mailing list