Calling wxGenericListCtrl::GetColumn with an invalid column index triggers an assertion error.
From what I can find about this function, it should return true or false to indicate whether the column index given was valid or not. Being able to use it to check if a column exists should be possible, yet it is not because it fails with the assertion before it gets the chance to return false.
ASSERT INFO:
../src/common/list.cpp(305): assert ""Assert failure"" failed in Item(): invalid index in wxListBase::Item
BACKTRACE:
[1] wxListBase::Item(unsigned long) const
[2] wxGenericListCtrl::GetColumn(int, wxListItem&) const
[3] LstOdaPlayerList::~LstOdaPlayerList() /home/mia/source/odamex/odalaunch/src/lst_players.cpp:205
[4] LstOdaPlayerList::~LstOdaPlayerList() /home/mia/source/odamex/odalaunch/src/lst_players.cpp:216
[5] wxWindowBase::Destroy()
[6] wxWindowBase::DestroyChildren()
[7] wxWindow::~wxWindow()
[8] wxWindowBase::Destroy()
[9] wxWindowBase::DestroyChildren()
[10] wxWindow::~wxWindow()
[11] wxSplitterWindow::~wxSplitterWindow()
[12] wxWindowBase::Destroy()
[13] wxWindowBase::DestroyChildren()
[14] wxWindow::~wxWindow()
[15] wxWindowBase::Destroy()
[16] wxWindowBase::DestroyChildren()
[17] wxWindow::~wxWindow()
[18] wxSplitterWindow::~wxSplitterWindow()
[19] wxWindowBase::Destroy()
[20] wxWindowBase::DestroyChildren()
[21] wxWindow::~wxWindow()
[22] wxWindowBase::Destroy()
[23] wxWindowBase::DestroyChildren()
[24] wxWindow::~wxWindow()
[25] wxFrame::~wxFrame() /usr/include/wx-3.2/wx/gtk/frame.h:16
[26] dlgMain::~dlgMain() /home/mia/source/odamex/odalaunch/src/dlg_main.cpp:297
[27] dlgMain::~dlgMain() /home/mia/source/odamex/odalaunch/src/dlg_main.cpp:297
[28] wxAppConsoleBase::DeletePendingObjects()
[29] wxAppConsoleBase::ProcessIdle()
[30] wxAppBase::ProcessIdle()
[31] wxApp::DoIdle()
[32] g_main_loop_run
[33] gtk_main
[34] wxGUIEventLoop::DoRun()
[35] wxEventLoopBase::Run()
[36] wxAppConsoleBase::MainLoop()
[37] wxEntry(int&, wchar_t**)
[38] main /home/mia/source/odamex/odalaunch/src/main.cpp:41
[39] __libc_start_main
[40] _start
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Sorry, your understanding of this function is incorrect. This is an accessor for the column and calling it with an invalid index is a programming error, use GetColumnCount() to ensure that this doesn't happen.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
I was unable to find any official documentation on this function, so all I had to go on was code that has been working for over a decade until now and some recommendations I found on using i this way. So I know how to best fix this code, what is the return value supposed to indicate?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
I don't understand how could it ever work, the assert was there ever since cf1dfa6 (virtual wxListCtrl support, 2001-07-06) even if it was changed a couple of times.
The return value is basically always true, i.e. for a valid column index the function can only return false if the native control fails to provide information about its column which never happens AFAIK. I'll update the official documentation to make it clear.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()