[Mono-bugs] [Bug 414446] Pressing Ctrl+C in MessageBox causes appl exit

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Aug 11 07:13:51 EDT 2008


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

User andyhume32 at yahoo.co.uk added comment
https://bugzilla.novell.com/show_bug.cgi?id=414446#c5





--- Comment #5 from Andy Hume <andyhume32 at yahoo.co.uk>  2008-08-11 05:13:51 MDT ---
Created an attachment (id=232680)
 --> (https://bugzilla.novell.com/attachment.cgi?id=232680)
Patch to XplatUIWin32.cs and Win32DnD.cs

This problem is also reproducable with a simple call to
Clipboard.SetText/SetDataObject -- I'll attach some other repro apps later.


So, I spent a while looking at this in a debugger and/or with heap diagnostics
enabled.  With both, a fault was reported inside user32!SetClipboardData but of
an unspecified corruption, not an overrun etc -- which was confirmed by manual
inspection of the data.

However a look at the MWF sources showed that a pointer to the data was being
passed to SetClipboardData.  The clipboard however uses memory handles, from
MSDN:
hMem -- [in] Handle to the data in the specified format. ... the hMem parameter
identifies a memory object, the object must have been allocated using the
function with the GMEM_MOVEABLE flag.

So a _possible_ patch attached: create the correct type of memory, copy the
data into it, and pass the handle.  This was correct already for the non text
cases BTW.  The attached patch removes lots of code duplication, and making the
ClipboardStore quite similar to the ClipboardRetrieve method; a less bold patch
is possible just calling SetClipboardData from each case!  I've tested the
Ansi/Unicode/Rtf/Bitmap paths; I don't when/if the converter code path is used.

The patch also makes the same fix to the drag-and-drop code.   How does one
test that code?


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