[Mono-dev] Patches for mono-winforms

Rob Wilkens robwilkens at gmail.com
Sat Jun 16 00:42:54 UTC 2012


I know my opinion is of mixed value, but it looks to make sense to me.. 
If the toolstripitem is being changed so it no longer has an owner,
calculating a size might not make sense....

-Rob

On 06/15/2012 08:34 PM, 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 lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20120615/0e63a64b/attachment.html>


More information about the Mono-devel-list mailing list