]> git.saurik.com Git - wxWidgets.git/commitdiff
Applied patch [ 746203 ] xwGrid::SetTable may be called multiple times
authorJulian Smart <julian@anthemion.co.uk>
Sun, 1 Jun 2003 12:51:06 +0000 (12:51 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Sun, 1 Jun 2003 12:51:06 +0000 (12:51 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20799 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/grid.cpp

index ef6fddb7e08b8b8398fd6bc40582dbdb9ce9ae24..78a7a2612e6e16cdb3b6571f7fb54d635e8795ee 100644 (file)
@@ -3913,16 +3913,18 @@ bool wxGrid::SetTable( wxGridTableBase *table, bool takeOwnership,
 {
     if ( m_created )
     {
-        // RD: Actually, this should probably be allowed.  I think it would be
-        //     nice to be able to switch multiple Tables in and out of a single
-        //     View at runtime.  Is there anything in the implementation that
-        //     would prevent this?
-
-        // At least, you now have to cope with m_selection
-        wxFAIL_MSG( wxT("wxGrid::CreateGrid or wxGrid::SetTable called more than once") );
-        return FALSE;
-    }
-    else
+        if (m_ownTable) 
+            delete m_table; 
+        delete m_selection; 
+        // stop all processing 
+        m_table=0; 
+        m_selection=0; 
+        m_created = FALSE; 
+        m_numRows=0; 
+        m_numCols=0; 
+    }
+    if (table)
     {
         m_numRows = table->GetNumberRows();
         m_numCols = table->GetNumberCols();