Closed Bug 87466 Opened 21 years ago Closed 21 years ago

Global object and focus stuff leaking via cycle, per window

Categories

(Core :: DOM: UI Events & Focus Handling, defect, P1)

x86
Linux
defect

Tracking

()

VERIFIED FIXED
mozilla0.9.2

People

(Reporter: dbaron, Assigned: dbaron)

Details

(Whiteboard: [PDT+])

Attachments

(1 file)

A bunch of focus related stuff leaks per-window via a cycle that includes the
global object, and, if a key is pressed in that window, drags in an XBL document
for each window where a key is pressed (which is 30K of logged (via
nsTraceRefcnt) objects per window, probably a good bit more (50% more? 500%
more?) of unlogged objects).  The following diagram explains what I'm seeing
(where |A| mFoo--> |B| represents A having a member mFoo that has an owning
pointer to B):

          Another GlobalWindowImpl, in one case but not the others
            ^
            |
         mOpener    mChromeEventHandler--
  ------------------                     \   --------------
  |GlobalWindowImpl|                      -> |nsWindowRoot|
  ------------------                         --------------
               ^             -----mFocusController     mListenerManager
              /             /                               /
             /             /                               /
            /             /   ------------------------    /
           /             /    |nsEventListenerManager| <--
     mFocusedWindow     v     ------------------------
      -------------------         m???Listeners
      |nsFocusController|           /    \
      ------------------- <---------      v
                                         -----------------------
                                         |nsXBLWindowKeyHandler|
                                         -----------------------
                                             |
                                             |
                                   (if a key is pressed)
                                             |
                                             v
                                     -------------------
                                     |nsXBLDocumentInfo|
                                     -------------------
                                             |
                                             v
                                       ------------
                                       |nsDocument|----> Content nodes
                                       ------------
This seems related to hyatt's fix for bug 54023.  He changed:

  nsIChromeEventHandler*        mChromeEventHandler; // Weak Reference         

to

  nsCOMPtr<nsIChromeEventHandler> mChromeEventHandler; // [Strong] We break it 
when we get torn down.

but I don't see any code to break the cycle when the global is torn down.  Such
code would be easy to write, though....

Well, the above patch works and it doesn't seem to do anything harmful after
about a minute of using the browser.  Are there any problems that it could cause?
Assignee: joki → dbaron
Severity: normal → major
Keywords: mlk, topmlk
Priority: -- → P1
Target Milestone: --- → mozilla0.9.2
Status: NEW → ASSIGNED
Keywords: mlk, topmlk
sr=hyatt
looks right to me, r=saari
Fix checked in 2001-06-26 14:29 PDT.
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Marking [PDT+] per conversation with chofmann.
Keywords: nsBranch
Whiteboard: [PDT+]
Fix checked into branch 2001-06-30 12:01 PDT.
marking verifed as per developers comments.

Status: RESOLVED → VERIFIED
Component: Event Handling → User events and focus handling
You need to log in before you can comment on or make changes to this bug.