- const wxDataViewTreeNode* node = GetTreeNodeByRow(row);
- if (!node)
- {
- // not really correct...
- return row + ((y-yy) / m_lineHeight);
- }
-
- wxDataViewItem item = node->GetItem();
-
- unsigned int cols = GetOwner()->GetColumnCount();
- unsigned int col;
- int height = m_lineHeight;
- for (col = 0; col < cols; col++)
- {
- const wxDataViewColumn *column = GetOwner()->GetColumn(col);
- if (column->IsHidden())
- continue; // skip it!
-
- if ((col != 0) && model->IsContainer(item) && !model->HasContainerColumns(item))
- continue; // skip it!
-
- const wxDataViewRenderer *renderer = column->GetRenderer();
- wxVariant value;
- model->GetValue( value, item, column->GetModelColumn() );
- wxDataViewRenderer *renderer2 = const_cast<wxDataViewRenderer*>(renderer);
- renderer2->SetValue( value );
- height = wxMax( height, renderer->GetSize().y );
- }
-
- yy += height;
- if (y < yy)
- return row;
-
- row++;
+ // Yes, if the node does not have any child, it must be a leaf which
+ // mean that it is a temporarily created by GetTreeNodeByRow
+ wxDELETE(node);