News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Assertion in JumpTracker

Started by Miguel Gimenez, October 21, 2025, 01:51:41 PM

Previous topic - Next topic

Miguel Gimenez

I have just used C::B (current trunk) on Mint 18 and get an assertion when closing C::B. It only asserts with the release, not the debug version, so I have a limited backtrace.


../src/generic/listctrl.cpp (3386)
assert "litem >= 0 && (size_t)litem < GetItemCount() failed in SetItemState(): invalid list ctrl item index in SetItem


Backtrace

1 wxGenericListCtrl::SetItemState(long, long, long)
2 JumpTrackerView::SetJumpTrackerViewIndex(int)
3 JumpTracker::SetJumpTrackerViewIndex(int)
4 JumpTracker::JumpDataAdd(wxString const&, long, long)
5 JumpTracker::OnEditorActivated(CodeBlocksEvent&)

stahta01

What wxWidgets version? I will see if the problems happens under Win10 MSys2 UCRT64.

Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

Miguel Gimenez

wxWidgets 3.0.2 32 bits
GTK+ 2.24.30

christo

Hi Miguel Gimenez, I have seen such a crash earlier. https://github.com/josephch/codeblocks/commit/5be7d91c955a481a48abe545a86342e9b30f8ed7 should help with this as list item's index should be always less than item count.

Pecan

Quote from: christo on October 21, 2025, 07:44:53 PM
Hi Miguel Gimenez, I have seen such a crash earlier. https://github.com/josephch/codeblocks/commit/5be7d91c955a481a48abe545a86342e9b30f8ed7 should help with this as list item's index should be always less than item count.

I'll make the change and test awhile.

Thanks

LETARTARE

#5
Leap-15.6-64bits, gcc-1520, wx-328, gtk3-unicode-3.2
Cb13752
Identical problem :
I did this :
void SetJumpTrackerViewIndex(int itemIndex)
{
    if (itemIndex < 0)
return;
    int knt = m_pListCtrl->GetItemCount();
    if (knt < 0)
        return;
    if (itemIndex >= knt)
return; //setting index before adding the item

    m_pListCtrl->SetItemState(itemIndex, wxLIST_STATE_SELECTED                                                   , wxLIST_STATE_SELECTED);
}


I'm testing a day ...
CB-13834, plugins-sdk-2.25.0 : Collector-2.6.5, AddOnForQt-5.1.2
1- Win7 Business Pack1 64bits : wx-3.2.8, gcc-15.2.0,
2- OpenSuse::Leap-15.6-64bits : wx-3.2.8;gtk3-u, gcc-15.2.0,
=> !! The messages are translated by 'Deepl'

Pecan