Grid crash when capture focus

Hello,

If capture grid EVT_SET_FOCUS, and make some grid operation in the event, python crash if close the Frame when you are editing a cell.

I attatch a sample:

. Run it,
. Enter to edit any cell,
. When are editing the cell click on 'x' button to close the frame

GridTest.py (1.27 KB)

···

--
*****************************************
Oswaldo Hernández
oswaldo (@) soft-com (.) es
*****************************************
PD:
Antes de imprimir este mensaje, asegúrese de que es necesario.
El medio ambiente está en nuestra mano.

Robin Dunn escribió:

Oswaldo Hernández wrote:

Hello,

If capture grid EVT_SET_FOCUS, and make some grid operation in the event, python crash if close the Frame when you are editing a cell.

I attatch a sample:

. Run it,
. Enter to edit any cell,
. When are editing the cell click on 'x' button to close the frame

You can probably use something like this to prevent the event handler from doing anything if it is in the process of being destroyed:

    if self.GetTopLevelParent().IsBeingDeleted():
        return

self.GetTopLevelParent() returns None if the frame is closing,

if not self.GetTopLevelParent() or self.GetTopLevelParent().IsBeingDeleted():
     return

works fine.

Thanks

···

--
*****************************************
Oswaldo Hernández
oswaldo (@) soft-com (.) es
*****************************************
PD:
Antes de imprimir este mensaje, asegúrese de que es necesario.
El medio ambiente está en nuestra mano.