[Mono-bugs] [Bug 543928] New: Removing the Selected TabPage From a TabControl Causes a Crash

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Oct 2 14:38:20 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=543928


           Summary: Removing the Selected TabPage From a TabControl Causes
                    a Crash
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.4.x
          Platform: 32bit
        OS/Version: Windows XP
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Windows.Forms
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: dglick at dracorp.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Description of Problem:
If you get TabControl.SelectedTab and then remove that TabPage from the
TabControl, a crash happens. Code (assuming a TabControl with multiple tabs on
a form):

TabPage tabPage = tabControl.SelectedTab;
tabControl.TabPages.Remove(tabPage);  //Crashes on this call

Steps to reproduce the problem:
1. 
2.

Actual Results:
Crash

Expected Results:
The TabPage is removed and an alternate TabPage becomes selected if any are
left

How often does this happen? 
Always

Additional Information:

Call stack:

System.ArgumentOutOfRangeException: ControlCollection does not have that many
controls
Parameter name: index
2
  at System.Windows.Forms.Control+ControlCollection.get_Item (Int32 index)
[0x00040] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4\mcs\class\Managed.Windows.F
orms\System.Windows.Forms\Control.cs:492
  at System.Windows.Forms.TabControl.GetTab (Int32 index) [0x00000] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4\mcs\class\Managed.Windows.Forms\System.Windo
ws.Forms\TabControl.cs:1391
  at (wrapper remoting-invoke-with-check)
System.Windows.Forms.TabControl:GetTab (int)
  at System.Windows.Forms.TabControl+TabPageCollection.get_Item (Int32 index)
[0x00000] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4\mcs\class\Managed.Window
s.Forms\System.Windows.Forms\TabControl.cs:1662
  at System.Windows.Forms.TabControl.get_SelectedTab () [0x0000e] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4\mcs\class\Managed.Windows.Forms\System.Windows
Forms\TabControl.cs:388
  at System.Windows.Forms.TabControl.set_SelectedIndex (Int32 value) [0x00095]
in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4\mcs\class\Managed.Windows.Forms\S
ystem.Windows.Forms\TabControl.cs:292
  at (wrapper remoting-invoke-with-check)
System.Windows.Forms.TabControl:set_SelectedIndex (int)
  at System.Windows.Forms.TabControl+ControlCollection.Remove
(System.Windows.Forms.Control value) [0x00076] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4\mcs
\class\Managed.Windows.Forms\System.Windows.Forms\TabControl.cs:1629
  at System.Windows.Forms.TabControl+TabPageCollection.Remove
(System.Windows.Forms.TabPage value) [0x00000] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4\mcs
\class\Managed.Windows.Forms\System.Windows.Forms\TabControl.cs:1813
  at MDITest.TabPane.Split (Orientation orientation, Boolean existingToPanel1)
[0x00029] in C:\Documents and Settings\dglick\My Documents\Visual Studio
2008\Pro
jects\MDITest\MDITest\TabPane.cs:233
  at (wrapper remoting-invoke-with-check) MDITest.TabPane:Split
(System.Windows.Forms.Orientation,bool)
  at MDITest.TabPane.TabControl_KeyDown (System.Object sender,
System.Windows.Forms.KeyEventArgs e) [0x00033] in C:\Documents and
Settings\dglick\My Documents\V
isual Studio 2008\Projects\MDITest\MDITest\TabPane.cs:121
  at System.Windows.Forms.Control.OnKeyDown (System.Windows.Forms.KeyEventArgs
e) [0x0001c] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4\mcs\class\Managed.Wi
ndows.Forms\System.Windows.Forms\Control.cs:6251
  at System.Windows.Forms.TabControl.OnKeyDown
(System.Windows.Forms.KeyEventArgs ke) [0x000d0] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4\mcs\class\Manage
d.Windows.Forms\System.Windows.Forms\TabControl.cs:787
  at System.Windows.Forms.Control.ProcessKeyEventArgs
(System.Windows.Forms.Message& m) [0x0004a] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4\mcs\class\Mana
ged.Windows.Forms\System.Windows.Forms\Control.cs:4708
  at System.Windows.Forms.Control.ProcessKeyMessage
(System.Windows.Forms.Message& m) [0x0001e] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4\mcs\class\Manage
d.Windows.Forms\System.Windows.Forms\Control.cs:4753
  at System.Windows.Forms.Control.WmKeys (System.Windows.Forms.Message& m)
[0x00000] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4\mcs\class\Managed.Windows.F
orms\System.Windows.Forms\Control.cs:5877
  at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m)
[0x0020c] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4\mcs\class\Managed.Windows.
Forms\System.Windows.Forms\Control.cs:5426
  at System.Windows.Forms.TabControl.WndProc (System.Windows.Forms.Message& m)
[0x0008e] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4\mcs\class\Managed.Windo
ws.Forms\System.Windows.Forms\TabControl.cs:891
  at System.Windows.Forms.Control+ControlWindowTarget.OnMessage
(System.Windows.Forms.Message& m) [0x00000] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4\mcs\
class\Managed.Windows.Forms\System.Windows.Forms\Control.cs:234
  at System.Windows.Forms.Control+ControlNativeWindow.WndProc
(System.Windows.Forms.Message& m) [0x00000] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4\mcs\cl
ass\Managed.Windows.Forms\System.Windows.Forms\Control.cs:215
  at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, IntPtr
wParam, IntPtr lParam) [0x00085] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4\mc
s\class\Managed.Windows.Forms\System.Windows.Forms\NativeWindow.cs:242
System.ArgumentOutOfRangeException: ControlCollection does not have that many
controls
Parameter name: index
2
  at System.Windows.Forms.Control+ControlCollection.get_Item (Int32 index)
[0x00040] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4\mcs\class\Managed.Windows.F
orms\System.Windows.Forms\Control.cs:492
  at System.Windows.Forms.TabControl.GetTab (Int32 index) [0x00000] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4\mcs\class\Managed.Windows.Forms\System.Windo
ws.Forms\TabControl.cs:1391
  at System.Windows.Forms.TabControl.GetTabRect (Int32 index) [0x00000] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4\mcs\class\Managed.Windows.Forms\System.W
indows.Forms\TabControl.cs:530
  at System.Windows.Forms.TabControl.WndProc (System.Windows.Forms.Message& m)
[0x00070] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4\mcs\class\Managed.Windo
ws.Forms\System.Windows.Forms\TabControl.cs:887
  at System.Windows.Forms.Control+ControlWindowTarget.OnMessage
(System.Windows.Forms.Message& m) [0x00000] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4\mcs\
class\Managed.Windows.Forms\System.Windows.Forms\Control.cs:234
  at System.Windows.Forms.Control+ControlNativeWindow.WndProc
(System.Windows.Forms.Message& m) [0x00000] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4\mcs\cl
ass\Managed.Windows.Forms\System.Windows.Forms\Control.cs:215
  at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, IntPtr
wParam, IntPtr lParam) [0x00085] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.4\mc
s\class\Managed.Windows.Forms\System.Windows.Forms\NativeWindow.cs:242
Press any key to continue . . .

-- 
Configure bugmail: http://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