From 0faa02efe69c23efc4fb0d74c9cb48d71267f8d8 Mon Sep 17 00:00:00 2001 From: "caillon%returnzero.com" Date: Mon, 28 Jul 2003 22:32:31 +0000 Subject: [PATCH] Introduce a weak ptr here to avoid extra addref/releases in this loop. r+sr=bzbarsky@mit.edu on irc. git-svn-id: svn://10.0.0.236/trunk@145297 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/html/content/src/nsHTMLLabelElement.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mozilla/content/html/content/src/nsHTMLLabelElement.cpp b/mozilla/content/html/content/src/nsHTMLLabelElement.cpp index 4e5056302dc..ba03ae171a5 100644 --- a/mozilla/content/html/content/src/nsHTMLLabelElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLLabelElement.cpp @@ -338,16 +338,17 @@ EventTargetIn(nsIPresContext *aPresContext, nsEvent *aEvent, aPresContext->GetEventStateManager(getter_AddRefs(esm)); nsCOMPtr c; esm->GetEventTargetContent(aEvent, getter_AddRefs(c)); - while (c) { - if (c == aChild) { + nsIContent *content = c; + while (content) { + if (content == aChild) { return PR_TRUE; } - if (c == aStop) { + if (content == aStop) { break; } - c = c->GetParent(); + content = content->GetParent(); } return PR_FALSE; }