[Mono-bugs] [Bug 66915][Maj] New - Calling back on a delegate passed to native code through p/invoke on a different thread causes a crash.

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Mon, 27 Sep 2004 13:35:46 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by daniel_l_christensen@yahoo.com.

http://bugzilla.ximian.com/show_bug.cgi?id=66915

--- shadow/66915	2004-09-27 13:35:46.000000000 -0400
+++ shadow/66915.tmp.23909	2004-09-27 13:35:46.000000000 -0400
@@ -0,0 +1,38 @@
+Bug#: 66915
+Product: Mono: Runtime
+Version: unspecified
+OS: 
+OS Details: SuSE 9.1 Pro
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: daniel_l_christensen@yahoo.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Calling back on a delegate passed to native code through p/invoke on a different thread causes a crash.
+
+Description of Problem:
+I've attached a sample application that demonstrates the problem. Here is a
+summary of what happens:
+
+1. Managed code uses DllImport to get access to a native function that
+takes a function pointer as a parameter.
+2. Managed code creates delegate to pass into native function.
+3. Managed delegate is marshalled as a native function pointer.
+4. Native code stores function pointer and fires up a new thread to
+complete some operation asynchronously.
+5. When the operation is complete the native code calls back on the
+function pointer to indicate that the operation is complete.
+6. Mono runtime blows up with the following error message:
+<errmsg>
+** ERROR **: file mini.c: line 6552 (mono_get_lmf_addr): should not be reached
+aborting...
+Aborted
+</errmsg>
+
+Similar code run under .NET on windows does not have a problem.