]> git.saurik.com Git - wxWidgets.git/commitdiff
Fixed bug that made adding a child to a branch (that was previously made empty) impos...
authorRobert Roebling <robert@roebling.de>
Sat, 5 Apr 2008 13:40:55 +0000 (13:40 +0000)
committerRobert Roebling <robert@roebling.de>
Sat, 5 Apr 2008 13:40:55 +0000 (13:40 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53024 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/datavgen.cpp

index 95231257c6d1d3cd543bb29011a969cf7e59c1a3..e64b805d364ef74f7e9bd8ef379f11fbfdbe95d2 100644 (file)
@@ -2458,11 +2458,6 @@ bool wxDataViewMainWindow::ItemDeleted(const wxDataViewItem& parent,
     //Make the row number invalid and get a new valid one when user call GetRowCount
     m_count = -1;
     node->ChangeSubTreeCount(sub);
     //Make the row number invalid and get a new valid one when user call GetRowCount
     m_count = -1;
     node->ChangeSubTreeCount(sub);
-    if( node->GetChildrenNumber() == 0)
-    {
-        node->GetParent()->GetNodes().Remove( node );
-        delete node;
-    }
 
     //Change the current row to the last row if the current exceed the max row number
     if( m_currentRow > GetRowCount() )
 
     //Change the current row to the last row if the current exceed the max row number
     if( m_currentRow > GetRowCount() )
@@ -3157,22 +3152,28 @@ wxDataViewTreeNode * wxDataViewMainWindow::FindNode( const wxDataViewItem & item
             }
 
             wxDataViewTreeNodes nodes = node->GetNodes();
             }
 
             wxDataViewTreeNodes nodes = node->GetNodes();
-            unsigned int i = 0;
-            for (; i < nodes.GetCount(); i ++)
+            unsigned int i;
+            bool found = false;
+            
+            for (i = 0; i < nodes.GetCount(); i ++)
             {
                 if (nodes[i]->GetItem() == (**iter))
                 {
             {
                 if (nodes[i]->GetItem() == (**iter))
                 {
+                    if (nodes[i]->GetItem() == item)
+                       return nodes[i];
+                       
                     node = nodes[i];
                     node = nodes[i];
+                    found = true;
                     break;
                 }
             }
                     break;
                 }
             }
-            if (i == nodes.GetCount())
+            if (!found)
                 return NULL;
         }
         else
             return NULL;
     }
                 return NULL;
         }
         else
             return NULL;
     }
-    return node;
+    return NULL;
 }
 
 void wxDataViewMainWindow::HitTest( const wxPoint & point, wxDataViewItem & item, wxDataViewColumn* &column )
 }
 
 void wxDataViewMainWindow::HitTest( const wxPoint & point, wxDataViewItem & item, wxDataViewColumn* &column )