wxWidgets / Phoenix

wxPython's Project Phoenix. A new implementation of wxPython, better, stronger, faster than he was before.
http://wxpython.org/
2.29k stars 516 forks source link

DeselectRow on MegaGrid causes C++ assertion #1766

Open plicit opened 4 years ago

plicit commented 4 years ago

Operating system: Windows 10 Pro 64-bit wxPython version & source: pypi wxPython v4.1.0 msw (phoenix) wxWidgets 3.1.4 Python version & source: stock Python v3.7.7-32, v3.7.7-64, v3.8.5-32

NOTE: Python v3.8.5-64 does NOT throw an exception! Unfortunately, I need to use 32-bit for a particular ODBC driver.

Description of the problem:

class MegaGrid(Grid.Grid):
    def OnLabelRightClicked(self, evt):
        # Did we click on a row or a column?
        row, col = evt.GetRow(), evt.GetCol()
        if row == -1: 
            self.colPopup(col, evt)
        elif col == -1:
            self.DeselectRow(row)
            #self.rowPopup(row, evt)

The above exception was the direct cause of the following exception:

SystemError: <class 'wx._grid.GridCellAttr.AttrKind'> returned a result with an error set

[01] wxGrid::GetColPos [02] wxGrid::RefreshBlock [03] wxGridSelection::DeselectBlock [04] wxGridSelection::DeselectBlock [05] PyInit_siplib [06] PyCFunction_Call [07] PyObject_MakeTpCall [08] PyOS_URandomNonblock [09] PyEval_GetFuncDesc [10] PyEval_EvalFrameDefault [11] PyObject_Call [12] PyFunction_Vectorcall [13] PyCell_Set [14] PyMethod_Self [15] PyVectorcall Call [16] PyObject_Call [17] PyEval_CallObjectWithKeywords [18] PyInit_core [19] wxAppConsoleBase::HandleEvent [20] wxAppConsoleBase::CallEventHandler [21] wxEvtHandler::ProcessEventIfMatchesId

swt2c commented 4 years ago

I don't know why you don't see the assertion with the 64-bit version. That seems odd.

Anyway, it's a bug in wxWidgets. I submitted a fix for it: https://github.com/wxWidgets/wxWidgets/pull/2017

plicit commented 4 years ago

Yeah it is odd. Thank you so much for passing it upstream! :-)

RobinD42 commented 2 years ago

This issue has been mentioned on Discuss wxPython. There might be relevant details there:

https://discuss.wxpython.org/t/errors-in-wxpython-app-using-grid-gridcellattr/35729/1