[Mono-bugs] [Bug 76979][Blo] New - Fix: TreeNodeTest.FullPathTest
throws NullReferenceException
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Tue Dec 13 07:41:25 EST 2005
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by dbjobs at snafu.de.
http://bugzilla.ximian.com/show_bug.cgi?id=76979
--- shadow/76979 2005-12-13 07:41:25.000000000 -0500
+++ shadow/76979.tmp.22580 2005-12-13 07:41:25.000000000 -0500
@@ -0,0 +1,107 @@
+Bug#: 76979
+Product: Mono: Class Libraries
+Version: 1.1
+OS:
+OS Details: SUSE 10 OSS
+Status: NEW
+Resolution:
+Severity:
+Priority: Blocker
+Component: Windows.Forms
+AssignedTo: peter at novonyx.com
+ReportedBy: dbjobs at snafu.de
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Fix: TreeNodeTest.FullPathTest throws NullReferenceException
+
+Description of Problem:
+TreeNodeTest.FullPathTest throws NullReferenceException
+
+Steps to reproduce the problem:
+1. Run TreeNodeTest.FullPathTest
+2.
+3.
+
+Actual Results:
+NullReferenceException
+
+Expected Results:
+Code should pass test
+
+How often does this happen?
+Always
+
+Additional Information:
+Below is a fix to TreeNodeCollection.cs to prevent
+TreeNodeTest.FullPathTest from failing and some other problems.
+
+* TreeNodeCollection.cs : Fixed bugs that among other things caused
+TreeNodeTest.FullPathTest to fail.
+
+Index: TreeNodeCollection.cs
+===================================================================
+--- TreeNodeCollection.cs (Revision 54253)
++++ TreeNodeCollection.cs (Arbeitskopie)
+@@ -115,18 +115,20 @@
+ // Remove it from any old parents
+ node.Remove ();
+
+- TreeView tree_view = owner.TreeView;
+- if (owner != null && tree_view != null &&
+tree_view.Sorted)
++ TreeView tree_view = null;
++ if (owner != null)
++ tree_view = owner.TreeView;
++ if (tree_view != null && tree_view.Sorted)
+ return AddSorted (node);
+ node.parent = owner;
+ if (count >= nodes.Length)
+ Grow ();
+ nodes [count++] = node;
+
+- if (tree_view != null && (owner.IsExpanded ||
+owner.IsRoot)) {
++ if (owner != null && tree_view != null &&
+(owner.IsExpanded || owner.IsRoot)) {
+ // XXX: Need to ensure the boxes for the
+nodes have been created
+ tree_view.UpdateNode (owner);
+- } else if (tree_view != null) {
++ } else if (owner != null && tree_view != null) {
+ tree_view.UpdateNodePlusMinus (owner);
+ }
+
+@@ -152,9 +154,12 @@
+ Array.Clear (nodes, 0, count);
+ count = 0;
+
+- TreeView tree_view = owner.TreeView;
+- if (tree_view != null)
+- tree_view.UpdateBelow (owner);
++ TreeView tree_view = null;
++ if (owner != null) {
++ tree_view = owner.TreeView;
++ if (tree_view != null)
++ tree_view.UpdateBelow (owner);
++ }
+ }
+
+ public bool Contains (TreeNode node)
+@@ -210,8 +215,10 @@
+ if (nodes.Length > OrigSize && nodes.Length >
+(count * 2))
+ Shrink ();
+
+- TreeView tree_view = owner.TreeView;
+- if (removed == tree_view.top_node) {
++ TreeView tree_view = null;
++ if (owner != null)
++ tree_view = owner.TreeView;
++ if (tree_view != null && removed ==
+tree_view.top_node) {
+ OpenTreeNodeEnumerator oe = new
+OpenTreeNodeEnumerator (removed);
+ if (oe.MoveNext () && oe.MoveNext ())
+ tree_view.top_node = oe.CurrentNode;
More information about the mono-bugs
mailing list