User forums > Using Code::Blocks

a debuuging check in this application has failed: in grid.h(1522)

(1/1)

yanjx:
when i open an old myPanel in Resources,there is a grid control in this panel. the new codeblocks20.03 always show me "wxWidgets Debug Alert" dialog:
  ..\..\include/wx/generic/grid.h(1522): assert "idx >=0 && idx < m_numCols" failed in GetColPos():invalid column index

but this alert dialog never showed in old codeblocks edition.I don't know why?

yanjx:
Pay attention:: I just open Resources, was not  debugging my program.this problem i have never seen in codeblocks 16.01 edition.

Pecan:
Just for Information, from Perplexity:

The assertion error "idx >= 0 && idx < m_numCols" in GetColPos() occurs when trying to access a column index that is out of bounds in a wxGrid1
4
. This error can happen in several scenarios:

    Empty Grid: When working with an empty wxGrid that has no columns defined7
    .
    Invalid Column Index: Attempting to access a column that doesn't exist or using an incorrect index1
    2
    .
    Resizing Issues: The error may occur when resizing columns, particularly when using the header area to resize1
    .

To resolve this issue, you can try the following:

    Ensure the grid has columns before accessing them:

cpp
if (grid->GetNumberCols() > 0) {
    // Perform operations on columns
}

    Double-check column indices, especially after column moves or deletions8
    .
    If the issue occurs during column resizing, add event.Skip() to any wx.grid.EVT_GRID_CELL_LEFT_CLICK event handlers1
    .
    When creating a grid, make sure to properly initialize it with the correct number of rows and columns4
    .

If the problem persists, it may be a bug in wxWidgets. Consider updating to the latest version or reporting the issue to the wxWidgets GitHub repository.

yanjx:
thank you for your reply:
I have tested many times:simply inserted a wxGrid control into a wxPanel,then changed the default size of this grid control.then this error message appeared,sometimes even exiting codeblocks.
i think this may be a bug of codeblocks.

stahta01:
You [should] know that the "wxWidgets Debug Alert" are fixed in the nightly builds; so, if you think it is in Code::Blocks install a nightly and likely that Alert will be gone. Note: Some new ones will arrive at the next wxWidgets version increase.

Tim S.

Navigation

[0] Message Index

Go to full version