]> git.saurik.com Git - wxWidgets.git/commitdiff
don't leave tables non-owned by the grid with dangling view pointer when the grid...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 4 Nov 2006 13:43:13 +0000 (13:43 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 4 Nov 2006 13:43:13 +0000 (13:43 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43034 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/grid.cpp

index a921b3817c8abc1f9b84fa0dacd225a8fe282fe7..e9917ab6df59e20f63251d530037ab36e19c6e4b 100644 (file)
@@ -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;