[Mono-dev] Patches for mono-winforms

Stifu stifu at free.fr
Tue Aug 14 09:20:00 UTC 2012


Steven, just FYI: this is either a disturbing coincidence, or someone
committed patch 10 without crediting you.

https://github.com/mono/mono/commit/427f608ef6c93f9f3f4d63c9d48f014f635ae181


Steven Boswell II wrote
> 
> Enclosed is a new patch, mostly for discussion purposes, since there's no
> unit test & I don't know how I would write one for this.
> 
> Today, after using my application in a particular way, I got it to crash,
> putting up an "Exception caught" window.  I can't reproduce the problem
> outside of running it in the MonoDevelop debugger, and there appears to be
> no way to copy the contents of the stack-trace tab in the exception-caught
> window (really? how the heck did THIS get missed?), so I can't post the
> full details.  But it starts at System.ComponentModel.Finalize() with a
> tool-strip-item (the one I selected seconds before the crash), and ends in
> System.Drawing.GDIPlus.CheckStatus(Status), where it reports "A null
> reference or invalid value was found [GDI+ status: InvalidParameter]".
> 
> I have no idea why a copy of my menu-item is getting finalized; I
> certainly didn't make a copy of it.  The good news is, this crash is
> consistently repeatable, if I just use my application in the same certain
> order.
> 
> Digging through the stack trace, I arrived at
> System.Windows.Forms.ToolStripItem.set_InternalOwner, where the owner was
> being set to null, and right afterwards, CalculateAutoSize() was being
> called.  Why would anyone need to calculate the size of a menu-item that
> isn't even connected to a menu any more?  So, for me, the bug fix was
> obvious: check if the owner isn't null before calling CalculateAutoSize().
>  That's what the enclosed patch does.
> 
> With this patch, the bug doesn't reproduce, and the menu-item I selected
> is still there and doing fine.
> 
> Any thoughts on the correctness of this bug fix?  Or how one would write a
> unit test for it?  Or how to copy the contents of the stack-trace tab in
> MonoDevelop's exception-caught window?
> 
> Steven Boswell
> 
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at .ximian
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
> 




--
View this message in context: http://mono.1490590.n4.nabble.com/Patches-for-mono-winforms-tp4649620p4652002.html
Sent from the Mono - Dev mailing list archive at Nabble.com.


More information about the Mono-devel-list mailing list