[Mono-bugs] [Bug 508586] New: On disposing components (Tooltip, MainMenu etc) from Form the components collection should be cleared too
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Sun May 31 19:21:18 EDT 2009
http://bugzilla.novell.com/show_bug.cgi?id=508586
Summary: On disposing components (Tooltip, MainMenu etc) from
Form the components collection should be cleared too
Classification: Mono
Product: Mono: Class Libraries
Version: 2.4.x
Platform: i686
OS/Version: openSUSE 11.1
Status: NEW
Severity: Normal
Priority: P5 - None
Component: Windows.Forms
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: ctype at mail.ru
QAContact: mono-bugs at lists.ximian.com
Found By: ---
User-Agent: Mozilla/5.0 (X11; U; Linux i686; uk; rv:1.9.0.10)
Gecko/2009042700 SUSE/3.0.10-1.1.1 Firefox/3.0.10 (.NET CLR 3.5.30729)
Calling Component.Dispose() should remove component from components collection
Reproducible: Always
Steps to Reproduce:
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
namespace DisposeToolTipBug
{
public class TestForm : Form
{
[STAThread]
private static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new TestForm());
}
void MainFormLoad(object sender, EventArgs e)
{
toolTip.Dispose();
if(components.Components.Count > 0)
throw new Exception("Components still contained ToolTip");
}
private System.ComponentModel.IContainer components = null;
public TestForm()
{
this.components = new System.ComponentModel.Container();
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
this.SuspendLayout();
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(292, 266);
this.Name = "MainForm";
this.Text = "DisposeControlBug";
this.Load += MainFormLoad;
this.ResumeLayout(false);
}
private System.Windows.Forms.ToolTip toolTip;
}
}
Actual Results:
System.Exception: Components still contained ToolTip
at DisposeToolTipBug.TestForm.MainFormLoad (System.Object sender,
System.EventArgs e) [0x00000]
at System.Windows.Forms.Form.OnLoad (System.EventArgs e) [0x00000]
at System.Windows.Forms.Form.OnLoadInternal (System.EventArgs e) [0x00000]
Expected Results:
No errors. components.Components.Count == 0 as in Microsoft.Net
--
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list