Reputation: 13
I have several wxFlexGridSizers that used to work in wxWigets version 2.8.11. After upgrading the wxWidgets library to 2.9.4 I am now getting an invalid column index in wxFlexGridSizer::AddGrowableCol().
Here is a sample of the sizer that I am creating:
wxFlexGridSizer* fgSizer1;
fgSizer1 = new wxFlexGridSizer( 3, 2, 0, 0 );
fgSizer1->AddGrowableCol( 2 );
fgSizer1->SetFlexibleDirection( wxBOTH );
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
I tried changing the value of the AddGrowableCol() arguement to 1 because maybe I thought it might have been wrong before or something but it still throws the same error. I can include the stacktrace if that would be helpful as well.
..\..\src\common\sizer.cpp(1956): assert "!m_cols || idx < (size_t)m_cols" failed in wxFlexGridSizer::AddGrowableCol(): invalid column index
Call stack:
[00] wxGUIAppTraitsBase::ShowAssertDialog j:\wxwidgets-2.9.4\src\common\appcmn.cpp:475
[01] ShowAssertDialog j:\wxwidgets-2.9.4\src\common\appbase.cpp:1265
[02] wxAppConsoleBase::OnAssertFailure j:\wxwidgets-2.9.4\src\common\appbase.cpp:761
[03] wxDefaultAssertHandler j:\wxwidgets-2.9.4\src\common\appbase.cpp:1065
[04] wxOnAssert j:\wxwidgets-2.9.4\src\common\appbase.cpp:1141
[05] wxFlexGridSizer::AddGrowableCol j:\wxwidgets-2.9.4\src\common\sizer.cpp:1956
[06] MyFrame::MyFrame c:\users\james\documents\code\wx29starter - copy (2)\minimal.cpp:181
[07] MyApp::OnInit c:\users\james\documents\code\wx29starter - copy (2)\minimal.cpp:130
[08] wxAppConsoleBase::CallOnInit j:\wxwidgets-2.9.4\include\wx\app.h:94
[09] wxEntryReal j:\wxwidgets-2.9.4\src\common\init.cpp:456
[10] wxEntry j:\wxwidgets-2.9.4\src\msw\main.cpp:189
[11] wxEntry j:\wxwidgets-2.9.4\src\msw\main.cpp:416
[12] WinMain c:\users\james\documents\code\wx29starter - copy (2)\minimal.cpp:111
[13] __tmainCRTStartup f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c:578
[14] WinMainCRTStartup f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c:403
[15] BaseThreadInitThunk
[16] RtlInitializeExceptionChain
[17] RtlInitializeExceptionChain
Here is the assert code
void wxFlexGridSizer::AddGrowableCol( size_t idx, int proportion )
{
wxASSERT_MSG( !IsColGrowable( idx ),
"AddGrowableCol() called for growable column" );
// see comment in AddGrowableRow(): although it's less common to omit the
// specification of the number of columns, it still can also happen
wxCHECK_RET( !m_cols || idx < (size_t)m_cols, "invalid column index" );
m_growableCols.Add( idx );
m_growableColsProportions.Add( proportion );
}
Upvotes: 0
Views: 1277
Reputation: 20586
With confirmation from winterblood changing the parameter to 1 for the call to AddGrowableCol()will solve the problem, despite your test!
Upvotes: 1