]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/grid.cpp
removed unused variable
[wxWidgets.git] / src / generic / grid.cpp
index a2994e167915ceb41b0d8827e908f7bc01a8426c..e9917ab6df59e20f63251d530037ab36e19c6e4b 100644 (file)
@@ -4163,7 +4163,7 @@ wxGrid::wxGrid( wxWindow *parent,
     m_rowMinHeights(GRID_HASH_SIZE)
 {
     Create();
     m_rowMinHeights(GRID_HASH_SIZE)
 {
     Create();
-    SetBestFittingSize(size);
+    SetInitialSize(size);
 }
 
 bool wxGrid::Create(wxWindow *parent, wxWindowID id,
 }
 
 bool wxGrid::Create(wxWindow *parent, wxWindowID id,
@@ -4178,7 +4178,7 @@ bool wxGrid::Create(wxWindow *parent, wxWindowID id,
     m_rowMinHeights = wxLongToLongHashMap(GRID_HASH_SIZE);
 
     Create();
     m_rowMinHeights = wxLongToLongHashMap(GRID_HASH_SIZE);
 
     Create();
-    SetBestFittingSize(size);
+    SetInitialSize(size);
 
     return true;
 }
 
     return true;
 }
@@ -4198,8 +4198,12 @@ wxGrid::~wxGrid()
              total ? (gs_nAttrCacheHits*100) / total : 0);
 #endif
 
              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;
         delete m_table;
+    else if ( m_table->GetView() == this )
+        m_table->SetView(NULL);
 
     delete m_typeRegistry;
     delete m_selection;
 
     delete m_typeRegistry;
     delete m_selection;
@@ -7708,10 +7712,10 @@ void wxGrid::DrawAllGridLines( wxDC& dc, const wxRegion & WXUNUSED(reg) )
     int i, j, cell_rows, cell_cols;
     wxRect rect;
 
     int i, j, cell_rows, cell_cols;
     wxRect rect;
 
-    for (j=topRow; j<bottomRow; j++)
+    for (j=topRow; j<=bottomRow; j++)
     {
         int colPos;
     {
         int colPos;
-        for (colPos=leftCol; colPos<rightCol; colPos++)
+        for (colPos=leftCol; colPos<=rightCol; colPos++)
         {
             i = GetColAt( colPos );
 
         {
             i = GetColAt( colPos );
 
@@ -7736,9 +7740,9 @@ void wxGrid::DrawAllGridLines( wxDC& dc, const wxRegion & WXUNUSED(reg) )
     int i, j, cell_rows, cell_cols;
     wxRect rect;
 
     int i, j, cell_rows, cell_cols;
     wxRect rect;
 
-    for (j=topRow; j<bottomRow; j++)
+    for (j=topRow; j<=bottomRow; j++)
     {
     {
-        for (i=leftCol; i<rightCol; i++)
+        for (i=leftCol; i<=rightCol; i++)
         {
             GetCellSize( j, i, &cell_rows, &cell_cols );
             if ((cell_rows > 1) || (cell_cols > 1))
         {
             GetCellSize( j, i, &cell_rows, &cell_cols );
             if ((cell_rows > 1) || (cell_cols > 1))