[Mono-bugs] [Bug 673645] Method passed to native code as callback is called with 'this' reference equaling 'null'
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Mon Feb 21 00:08:10 EST 2011
https://bugzilla.novell.com/show_bug.cgi?id=673645
https://bugzilla.novell.com/show_bug.cgi?id=673645#c1
Zoltan Varga <vargaz at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |vargaz at gmail.com
--- Comment #1 from Zoltan Varga <vargaz at gmail.com> 2011-02-21 05:08:09 UTC ---
You should make sure that the delegate which is passed to native code is kept
alive somehow, i.e. changing your example to:
static Action f;
static void Main()
{
f = new Foo ().Bar;
initialize(f);
while(true) execute();
}
Otherwise, the runtime will collect the delegate, causing all kinds of strange
crashes, see:
http://www.mono-project.com/Interop_with_Native_Libraries#Memory_Boundaries
You can run with MONO_DEBUG=keep-delegates to have the runtime detect this
error automatically.
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list