[Mono-bugs] [Bug 349800] New: Exception in FromUnManagedMemoryToPoint (IntPtr prt, PointF [] pts)

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Dec 19 09:52:03 EST 2007


https://bugzilla.novell.com/show_bug.cgi?id=349800


           Summary: Exception in FromUnManagedMemoryToPoint (IntPtr prt,
                    PointF [] pts)
           Product: Mono: Class Libraries
           Version: 1.2.4
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: Sys.Drawing.
        AssignedTo: mono-bugs at ximian.com
        ReportedBy: nikki at trumphurst.com
         QAContact: mono-bugs at ximian.com
          Found By: Customer


The code for FromUnManagedMemoryToPoint (IntPtr prt, PointF [] pts) contains
the following typo:
  pts[i] = (PointF) Marshal.PtrToStructure(pos, typeof(Point));
which is obviously wrong (you can't cast a Point to a PointF)
Perhaps it should read:
  pts[i] = (PointF) Marshal.PtrToStructure(pos, typeof(PointF));
or maybe it should be:
  Point p = Marshal.PtrToStructure(pos, typeof(PointF));
  pts[i] = new PointF(p.X, p.Y);
(depending what is actually in prt, two floats or two ints)

The existing code throws an exception when you call any method that uses this
e.g. 
void Transform(Graphics g, PointF [] transformed) {
        g.TransformPoints(System.Drawing.Drawing2D.CoordinateSpace.Page,
System.Drawing.Drawing2D.CoordinateSpace.Device, transformed);
}


-- 
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