From 27a6c7d6ec43b5ec937e6b3687680404f565b75c Mon Sep 17 00:00:00 2001 From: "kmcclusk%netscape.com" Date: Thu, 31 Aug 2000 02:31:17 +0000 Subject: [PATCH] Revert back to old loop construct for dispatching events which is safer when the event destroys the current view bug 50335 r=attinasi@netscape.com git-svn-id: svn://10.0.0.236/trunk@77713 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/view/src/nsView.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/mozilla/view/src/nsView.cpp b/mozilla/view/src/nsView.cpp index 3ce5e5e266d..078526b63da 100644 --- a/mozilla/view/src/nsView.cpp +++ b/mozilla/view/src/nsView.cpp @@ -322,14 +322,20 @@ NS_IMETHODIMP nsView :: HandleEvent(nsGUIEvent *event, PRUint32 aEventFlags, //see if any of this view's children can process the event if (*aStatus == nsEventStatus_eIgnore && !(mVFlags & NS_VIEW_PUBLIC_FLAG_DONT_CHECK_CHILDREN)) { + PRInt32 numkids; nsRect trect; nscoord x, y; + GetChildCount(numkids); x = event->point.x; y = event->point.y; - nsIView *pKid = mFirstChild; - while (nsnull != pKid) { + for (PRInt32 cnt = 0; cnt < numkids && !aHandled; cnt++) + { + nsIView *pKid; + GetChild(cnt, pKid); + if (!pKid) break; + pKid->GetBounds(trect); if (PointIsInside(*pKid, x, y)) @@ -346,7 +352,6 @@ NS_IMETHODIMP nsView :: HandleEvent(nsGUIEvent *event, PRUint32 aEventFlags, event->point.x += trect.x; event->point.y += trect.y; } - pKid->GetNextSibling(pKid); } }