Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: Miguel Gimenez on October 21, 2025, 01:51:41 pm

Title: Assertion in JumpTracker
Post by: Miguel Gimenez on October 21, 2025, 01:51:41 pm
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.

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

Backtrace
Code
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&)
Title: Re: Assertion in JumpTracker
Post by: stahta01 on October 21, 2025, 03:15:00 pm
What wxWidgets version? I will see if the problems happens under Win10 MSys2 UCRT64.

Tim S.
Title: Re: Assertion in JumpTracker
Post by: Miguel Gimenez on October 21, 2025, 03:24:25 pm
wxWidgets 3.0.2 32 bits
GTK+ 2.24.30
Title: Re: Assertion in JumpTracker
Post by: 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.
Title: Re: Assertion in JumpTracker
Post by: Pecan on October 22, 2025, 07:34:37 am
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
Title: Re: Assertion in JumpTracker
Post by: LETARTARE on October 22, 2025, 05:31:36 pm
Leap-15.6-64bits, gcc-1520, wx-328, gtk3-unicode-3.2
Cb13752
Identical problem :
I did this :
Code
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 ...
Title: Re: Assertion in JumpTracker
Post by: Pecan on October 22, 2025, 08:09:51 pm
Fixes applied svn 13753
Thanks