Bug 329465. Don't hold a strong ref to the event queue service from nsComboboxControlFrame. r+sr=roc, patch by Marc Liddell.

This commit is contained in:
roc+@cs.cmu.edu
2006-03-09 19:24:54 +00:00
parent d5a3cfd0bd
commit 75dfaa348b
2 changed files with 10 additions and 34 deletions

View File

@@ -69,6 +69,7 @@
#include "nsXPCOM.h"
#include "nsISupportsPrimitives.h"
#include "nsIComponentManager.h"
#include "nsContentUtils.h"
#include "nsITextContent.h"
#include "nsTextFragment.h"
#include "nsCSSFrameConstructor.h"
@@ -405,20 +406,6 @@ NS_IMETHODIMP nsComboboxControlFrame::GetAccessible(nsIAccessible** aAccessible)
}
#endif
NS_IMETHODIMP
nsComboboxControlFrame::Init(
nsIContent* aContent,
nsIFrame* aParent,
nsStyleContext* aContext,
nsIFrame* aPrevInFlow)
{
mEventQueueService = do_GetService(kEventQueueServiceCID);
return nsAreaFrame::Init(aContent, aParent, aContext, aPrevInFlow);
}
void
nsComboboxControlFrame::SetFocus(PRBool aOn, PRBool aRepaint)
{
@@ -1601,12 +1588,13 @@ nsComboboxControlFrame::RedisplayText(PRInt32 aIndex)
// Send reflow command because the new text maybe larger
nsresult rv = NS_OK;
if (mDisplayContent && mEventQueueService) {
if (mDisplayContent) {
// Don't call ActuallyDisplayText(PR_TRUE) directly here since that
// could cause recursive frame construction. See bug 283117 and the comment in
// HandleRedisplayTextEvent() below.
nsCOMPtr<nsIEventQueue> eventQueue;
rv = mEventQueueService->GetSpecialEventQueue(nsIEventQueueService::UI_THREAD_EVENT_QUEUE,
rv = nsContentUtils::EventQueueService()->
GetSpecialEventQueue(nsIEventQueueService::UI_THREAD_EVENT_QUEUE,
getter_AddRefs(eventQueue));
if (eventQueue) {
RedisplayTextEvent* event = new RedisplayTextEvent(this);
@@ -1954,13 +1942,12 @@ NS_IMETHODIMP
nsComboboxControlFrame::Destroy(nsPresContext* aPresContext)
{
// Revoke queued RedisplayTextEvents
if (mEventQueueService) {
nsCOMPtr<nsIEventQueue> eventQueue;
mEventQueueService->GetSpecialEventQueue(nsIEventQueueService::UI_THREAD_EVENT_QUEUE,
getter_AddRefs(eventQueue));
if (eventQueue) {
eventQueue->RevokeEvents(this);
}
nsCOMPtr<nsIEventQueue> eventQueue;
nsContentUtils::EventQueueService()->
GetSpecialEventQueue(nsIEventQueueService::UI_THREAD_EVENT_QUEUE,
getter_AddRefs(eventQueue));
if (eventQueue) {
eventQueue->RevokeEvents(this);
}
nsFormControlFrame::RegUnRegAccessKey(GetPresContext(), NS_STATIC_CAST(nsIFrame*, this), PR_FALSE);

View File

@@ -106,13 +106,6 @@ public:
NS_IMETHOD GetAccessible(nsIAccessible** aAccessible);
#endif
// nsIFrame
NS_IMETHOD Init(
nsIContent* aContent,
nsIFrame* aParent,
nsStyleContext* aContext,
nsIFrame* aPrevInFlow);
NS_IMETHOD Reflow(nsPresContext* aCX,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
@@ -267,8 +260,6 @@ protected:
// then open or close the combo box.
nsCOMPtr<nsIDOMMouseListener> mButtonListener;
nsCOMPtr<nsIEventQueueService> mEventQueueService;
// static class data member for Bug 32920
// only one control can be focused at a time
static nsComboboxControlFrame * mFocused;
@@ -283,5 +274,3 @@ private:
};
#endif