Ticket #15475 (closed defect: fixed)
Bug when inserting an empty sizer in a wxGridBagSizer
|Reported by:||briceandre||Owned by:|
|Keywords:||wxGridBagSizer empty sizer||Cc:|
I think that I found a bug when inserting an empty sizer in a wxGridBagSizer. If the wxGridBagSizer does not contain anything else, there is a crash at the next Layout performed on the sizer or one of its parents.
I tried to investigate the problem and I think that I have some clue of where the problem is located : when performing the layout, the function performs first a CalcMin function call. This function does not take into account the empty sizer when performing the computation as this sizer is empty, and thus, it resets the number of rows and cols to zero.
But, then, when the function performs the recalcSize, there is a discrepancy because there is a child in the sizer and it does not match the number of cols and rows. So, there is first an assert followed by a crash.
I joined a small example that generates the bug. The dialog displays a button. When the dialog opens, it displays an empty wxGridBagSizer which does not cause any trouble. When one click on the button, an empty wxGridBagSizer is added to the existing one and thus, the layout function causes the crash.
I use a wxWidgets 2.9.5 compiled under Windows (MSVC-2010) in static unicode multi-lib version.