[Mono-dev] Form.CheckAcceptButton()

David Suarez dsuarezv at codicesoftware.com
Tue Oct 16 08:12:09 EDT 2007


Hi all, 

Using a set of non-standard button classes I have found an issue in the
Form.AcceptButton method. Problem is with this piece of code: 

internal override void CheckAcceptButton()
{
    if (accept_button != null) {
        Button a_button = accept_button as Button;
        
        if (ActiveControl == a_button)
            return;
        
        if (ActiveControl is Button) {
            a_button.paint_as_acceptbutton = false;
            a_button.Invalidate();
            return;
        } else {
            a_button.paint_as_acceptbutton = true;
            a_button.Invalidate();
        }
    }
}

While accept_button is defined in MSDN as IButtonControl, here it is casted
to Button. The result is that a form with an non-standard Button in the
acceptbutton property throws a nullref. 

I've filled 334244 in bugzilla

Cheers, 

David





More information about the Mono-devel-list mailing list