From 86020f7e330bcafc746e1f3b86ec6933d6c11811 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 4 Nov 2006 13:43:13 +0000 Subject: [PATCH] don't leave tables non-owned by the grid with dangling view pointer when the grid is deleted (patch 1310535) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43034 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/grid.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index a921b3817c..e9917ab6df 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -4198,8 +4198,12 @@ wxGrid::~wxGrid() total ? (gs_nAttrCacheHits*100) / total : 0); #endif - if (m_ownTable) + // if we own the table, just delete it, otherwise at least don't leave it + // with dangling view pointer + if ( m_ownTable ) delete m_table; + else if ( m_table->GetView() == this ) + m_table->SetView(NULL); delete m_typeRegistry; delete m_selection; -- 2.47.2