[Mono-bugs] [Bug 590015] New: Class inherited from SafeHandle is not marshaled properly

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun Mar 21 07:01:41 EDT 2010


http://bugzilla.novell.com/show_bug.cgi?id=590015

http://bugzilla.novell.com/show_bug.cgi?id=590015#c0


           Summary: Class inherited from SafeHandle is not marshaled
                    properly
    Classification: Mono
           Product: Mono: Runtime
           Version: 2.6.x
          Platform: x86
        OS/Version: openSUSE 11.3
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: interop
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: pavel.savara at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Created an attachment (id=349656)
 --> (http://bugzilla.novell.com/attachment.cgi?id=349656)
Contains code and test to reproduce the problem

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.8)
Gecko/20100202 Firefox/3.5.8

Full source for the test attached.

public class IntPtrSafe : SafeHandle { ...  }

[DllImport("dummy.so")]
static extern IntPtrSafe jni4net_dummy(IntPtrSafe ptrSafe);

// this throws System.ObjectDisposedException
// but it should return Zero handle as it does on MS.NET
IntPtrSafe test1 = jni4net_dummy(new IntPtrSafe());

C/C++
void* jni4net_dummy(void* ptr)
{
    return ptr;
} 

Reproducible: Always

Steps to Reproduce:
1. unzip attachment
2. call comp script to compile
3. call test script to execute

Actual Results:  
------------------------ SafeHandle ----------------------------
safehandle 1 System.ObjectDisposedException: The object was used after being
disposed.
  at System.Runtime.InteropServices.SafeHandle.DangerousAddRef (System.Boolean&
success) [0x00000] in <filename unknown>:0
  at (wrapper managed-to-native)
ReturnIntPtrStruct.BrokenSafeHandle:jni4net_dummy
(ReturnIntPtrStruct.BrokenSafeHandle/IntPtrSafe)
  at ReturnIntPtrStruct.BrokenSafeHandle.test () [0x00000] in <filename
unknown>:0
1
349888
349864
++++++++++++++++++++++++ SafeHandle ++++++++++++++++++++++++++++

Expected Results:  
------------------------ SafeHandle ----------------------------
0
1
0
1
++++++++++++++++++++++++ SafeHandle ++++++++++++++++++++++++++++

-- 
Configure bugmail: http://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