bugDotGNU Portable.NET - Bugs: bug #11434, TreeNode Onwer Not Set via...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #11434: TreeNode Onwer Not Set via TreeNodesCollection.AddRange

Submitted by:  None
Submitted on:  Wed 29 Dec 2004 12:34:28 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

Fri 18 Feb 2005 07:46:42 AM UTC, comment #1:

fixed in cvs

Deryk Robosson <drobosson>
Project Member
Wed 29 Dec 2004 12:34:28 PM UTC, original submission:

class System.Windows.Forms.TreeNodeCollection;
within pnetlib 0.6.8

Reproduction program source:
//------------- Form1.cs
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace WindowsApplication1
{

public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.TreeView treeView1;

private System.ComponentModel.Container components = null;

public Form1()
{
InitializeComponent();
}

protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

private void InitializeComponent()
{
this.treeView1 = new System.Windows.Forms.TreeView();
this.SuspendLayout();
//
// treeView1
//
this.treeView1.ImageIndex = -1;
this.treeView1.Location = new System.Drawing.Point(8, 8);
this.treeView1.Name = "treeView1";
this.treeView1.Nodes.AddRange(
new System.Windows.Forms.TreeNode[] {
new System.Windows.Forms.TreeNode("top 1",
new System.Windows.Forms.TreeNode[]{new System.Windows.Forms.TreeNode("Node 1")}),
new System.Windows.Forms.TreeNode("top 2")});
this.treeView1.SelectedImageIndex = -1;
this.treeView1.Size = new System.Drawing.Size(272, 208);
this.treeView1.TabIndex = 6;
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(292, 269);
this.Controls.Add(this.treeView1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);

}

[STAThread]
static void Main()
{
Application.Run(new Form1());
}
}
}
------------------------------------
When toggle node "top1", you would get exception about null reference.

Solution,(sorry i don't know how to do patch now)
replace void TreeNodeCollection.Add (TreeNodeCollection.cs:108)
by
public virtual int Add(TreeNode node)
{
if (node.treeView != null && node.treeView.Sorted)
{
return owner.AddSorted(node);
}
else
{
owner.SizeChildrenArray();
set_node_owner(node);
node.parent = owner;
int pos = owner.childCount++;
node.index = pos;
owner.children[node.index] = node;
// Redraw if required.
if (node.treeView != null && node.treeView.IsHandleCreated)
{
node.treeView.Draw(owner);
}
return pos;
}
}
private void set_node_owner(TreeNode node)
{
node.treeView = owner.TreeView;
foreach(TreeNode cn in node.Nodes)
set_node_owner(cn);
}

Anonymous

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

Follow 2 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Fri 18 Feb 2005 07:46:42 AM UTCdrobossonStatusNone=>Fixed
  Open/ClosedOpen=>Closed

Back to the top


Powered by Savane 3.1-cleanup1