bugDotGNU Portable.NET - Bugs: bug #10392, Control.ContainsFocus causes an...

 
 

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

bug #10392: Control.ContainsFocus causes an stack overflow

Submitter:  None
Submitted:  Wed 15 Sep 2004 07:47:39 AM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed

Wed 15 Sep 2004 11:02:58 PM UTC, comment #1: 

Fix committed to CVS - 16 Sep 2004

Rhys Weatherley <rweather>
Group administrator
Wed 15 Sep 2004 07:47:39 AM UTC, original submission:  

If U derive a class from control and overwrite the get property Focused and then call ContainsFocus within this U'll get an StackOverflow.
Try this:
public class MyControl : public Control
{
 public override bool Focused
 {
  get
  {
   return this.ContainsFocus;
  }
 }
}

if U call MyControl.Focused -> Stack Overflow.

I did a quickhack in Control.cs:

public bool ContainsFocus
{
get
{
 // Heiko Weiss, do not call Focused, maybe some derived classes overwrite Focused
 if(toolkitWindow != null && toolkitWindow.Focused) return true;

 /* Do not do the following lines
 if (Focused)
 {
  return true;
 }
 */
 for (int i = 0; i < numChildren; i++)
 {
  if (children[i].ContainsFocus)
  {
   return true;
  }
 }
 return false;
 }
}

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

 

Follow 2 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2004-09-15 rweather StatusNone Fixed
    Open/ClosedOpen Closed

Back to the top

Powered by Savane 3.13-4448.
Corresponding source code