Bugzilla – Bug 317351
SWF.Control::CreateControl not always called
Last modified: 2007-12-13 18:26:27 UTC
---- Reported by 4lw0e0402@sneakemail.com 2005-03-01 21:37:17 MST ---- Description of Problem: Under certain circumstances, the CreateControl() method of Control is not called. Steps to reproduce the problem: The problem is reproduced with the attached test case. It consists of a custom Form and a custom Control. The control changes its background colour from red to green when OnControlCreated notification is received. The Form displays two checkboxes which also indicate whether OnControlCreated has been called for the Form and the Control, respectively. The test case takes one command-line argument: When "-direct" is the first parameter on the command-line, the custom Form is passed directly to Application.Run. Otherwise, a generic Form is created with a Button which, when clicked, creates the custom Form and calls its Show() method. Actual Results: When the "-direct" flag is passed to the test case, CreateControl() is called as expected for both the Form and the Control it contains. However, without the "-direct" flag, when the problem Form is not the first form created (the form passed to Application.Run), neither Form nor Control have their CreateControl method called. Expected Results: Based on observation of code running under Microsoft's implementation of System.Windows.Forms, CreateControl should always be called at some point near the start of the control's lifetime. Additional Information: 'pdb' of #mono-winforms on irc.gnome.org created an initial patch, in his words a hack. It is attached to this bug for reference, in case it will help with the creation of a production-quality patch. ---- Additional Comments From 4lw0e0402@sneakemail.com 2005-03-01 21:39:24 MST ---- Created an attachment (id=167520) Test case (C# source code) ---- Additional Comments From 4lw0e0402@sneakemail.com 2005-03-01 21:40:49 MST ---- Created an attachment (id=167521) Initial "hack" patch (against SVN revision 41339) ---- Additional Comments From peter@novonyx.com 2005-03-09 03:11:01 MST ---- Fixed in SVN. If the 'hack' attached to this bug was applied, it needs to be reverted before updating. Sorry for the delay in getting this fixed, had a bout with the flu. Imported an attachment (id=167520) Imported an attachment (id=167521)