From: Vadim Zeitlin Date: Mon, 22 Sep 2008 16:12:46 +0000 (+0000) Subject: don't crash if the grid is being deleted while a cell editor is still shown (closes... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/b09b3048c9ec43f6dd432eb07554559d43695c44 don't crash if the grid is being deleted while a cell editor is still shown (closes #9991) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55798 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index e8ca4e0102..708baf71b0 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -4532,6 +4532,11 @@ bool wxGrid::Create(wxWindow *parent, wxWindowID id, wxGrid::~wxGrid() { + // Ensure that the editor control is destroyed before the grid is, + // otherwise we crash later when the editor tries to do something with the + // half destroyed grid + HideCellEditControl(); + // Must do this or ~wxScrollHelper will pop the wrong event handler SetTargetWindow(this); ClearAttrCache();