Closed Bug 265436 Opened 20 years ago Closed 11 years ago

Closing child window generates "GetPrimaryFrameFor() called while nsFrameManager is being destroyed!"

Categories

(Core :: XUL, defect)

x86
All
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: mmokrejs, Unassigned)

Details

Attachments

(2 files)

User-Agent:       Mozilla/4.0 (compatible; MSIE 6.0; X11; Linux i686) Opera 7.54  [en]
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8a5) Gecko/20041021

Imagine starting a new window using File/New window, and closing that window 
using File/Close window

++WEBSHELL == 11
++DOMWINDOW == 12
++WEBSHELL == 12
++DOMWINDOW == 13
Document http://www.mozilla.org/start/ loaded successfully
GetPrimaryFrameFor() called while nsFrameManager is being destroyed!
GetPrimaryFrameFor() called while nsFrameManager is being destroyed!
--WEBSHELL == 11
--WEBSHELL == 10
--DOMWINDOW == 12
--DOMWINDOW == 11

Is that an error or debug message? Could it be labeled as with "Debug: " in 
fornt or with "Error: " in front? How do you know what messages are debug and 
what are error messages? ;)


On a similar note, what's this? I see 
"NS_ENSURE_TRUE(NS_SUCCEEDED(EnsureScriptEnvironment())) failed" all the time. ;
)

++WEBSHELL == 9
++DOMWINDOW == 10
++WEBSHELL == 10
++DOMWINDOW == 11
Document http://www.mozilla.org/start/ loaded successfully
++WEBSHELL == 11
++DOMWINDOW == 12
++WEBSHELL == 12
++DOMWINDOW == 13
Document about: loaded successfully
GetPrimaryFrameFor() called while nsFrameManager is being destroyed!
GetPrimaryFrameFor() called while nsFrameManager is being destroyed!
WARNING: NS_ENSURE_TRUE(NS_SUCCEEDED(EnsureScriptEnvironment())) failed, file 
nsWebShell.cpp, line 290
WARNING: NS_ENSURE_TRUE(NS_SUCCEEDED(EnsureScriptEnvironment())) failed, file 
nsWebShell.cpp, line 290
--WEBSHELL == 11
--WEBSHELL == 10
--DOMWINDOW == 12
--DOMWINDOW == 11


Reproducible: Always
Steps to Reproduce:
1.
2.
3.
The issue here is that ~nsMenuBarFrame fires an event (via SetActive(PR_FALSE)).
 This event ends up calling into GetPrimaryFrameFor() on the frame's content...

I'm not sure it's correct to do the event thing when the SetActive() call is
coming from the destructor.  Perhaps we should factor out the mKeyboardNavigator
release out of SetActive() and call it from both places?  Or add an arg to
SetActive()?  In general, firing events from frame code is just dangerous...
Component: Browser-General → XP Toolkit/Widgets: XUL
No, the issue is in nsMenuFrame.cpp at about line 1620:
  // XXX HACK. Just gracefully exit if the node has been removed, e.g.,
  // window.close() was executed.
  nsIFrame* primary = nsnull;
  if (shell) shell->GetPrimaryFrameFor(content, &primary); // <-- ASSERTS HERE

  // Now properly close them all up.
  if (content->GetDocument() &&     // <-- HACK IS HERE. ICK.
      (primary == me) && mMenuParent)
    mMenuParent->DismissChain();
  // END HACK
This is a patch I wrote to prove that it's not SetActive.
I attached it because you might want to use it for other reasons.
This is an automated message, with ID "auto-resolve01".

This bug has had no comments for a long time. Statistically, we have found that
bug reports that have not been confirmed by a second user after three months are
highly unlikely to be the source of a fix to the code.

While your input is very important to us, our resources are limited and so we
are asking for your help in focussing our efforts. If you can still reproduce
this problem in the latest version of the product (see below for how to obtain a
copy) or, for feature requests, if it's not present in the latest version and
you still believe we should implement it, please visit the URL of this bug
(given at the top of this mail) and add a comment to that effect, giving more
reproduction information if you have it.

If it is not a problem any longer, you need take no action. If this bug is not
changed in any way in the next two weeks, it will be automatically resolved.
Thank you for your help in this matter.

The latest beta releases can be obtained from:
Firefox:     http://www.mozilla.org/projects/firefox/
Thunderbird: http://www.mozilla.org/products/thunderbird/releases/1.5beta1.html
Seamonkey:   http://www.mozilla.org/projects/seamonkey/
Component: XP Toolkit/Widgets: XUL → XP Toolkit/Widgets: Menus
Still happens with:

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9a1) Gecko/20051122 SeaMonkey/1.5a
Still happeneing in trunk 2008-01-18 when closing a tab from http://tvtropes.org/ via the tab's close button, so it doesn't look like a menu issue; sometimes associated with bug 297637

Stack trace is:

#0  nsFrameManager::GetPrimaryFrameFor (this=0x8d4107c, aContent=0x961d320,
    aIndexHint=-1) at ../../../layout/base/nsFrameManager.cpp:330
#1  0xb5fa490e in PresShell::GetPrimaryFrameFor (this=0x8d41060,
    aContent=0x961d320) at ../../../layout/base/nsPresShell.cpp:4784
#2  0xb5fa0c80 in PresShell::GetCurrentEventFrame (this=0x8d41060)
    at ../../../layout/base/nsPresShell.cpp:5322
#3  0xb5fa4f51 in PresShell::HandleEventInternal (this=0x8d41060,
    aEvent=0xbf99a378, aView=0x9cfaba8, aStatus=0xbf99a174)
    at ../../../layout/base/nsPresShell.cpp:5844
#4  0xb5fa5c6f in PresShell::HandleEvent (this=0x8d41060, aView=0x9cfaba8,
    aEvent=0xbf99a378, aEventStatus=0xbf99a174)
    at ../../../layout/base/nsPresShell.cpp:5623
#5  0xb634c6e0 in nsViewManager::HandleEvent (this=0x8650938, aView=0x9cfaba8,
    aPoint=@0xbf99a240, aEvent=0xbf99a378, aCaptured=0)
    at ../../../view/src/nsViewManager.cpp:1294
#6  0xb634f7d3 in nsViewManager::DispatchEvent (this=0x8650938,
    aEvent=0xbf99a378, aStatus=0xbf99a28c)
    at ../../../view/src/nsViewManager.cpp:1250
#7  0xb63481e3 in HandleEvent (aEvent=0xbf99a378)
    at ../../../view/src/nsView.cpp:168
#8  0xb5a921c4 in nsCommonWidget::DispatchEvent (this=0x9b9f920,
    aEvent=0xbf99a378, aStatus=@0xbf99a408)
    at ../../../../widget/src/gtk2/nsCommonWidget.cpp:156
#9  0xb5a8708a in nsWindow::OnKeyPressEvent (this=0x9b9f920,
    aWidget=0x8437c28, aEvent=0x86d36e8)
    at ../../../../widget/src/gtk2/nsWindow.cpp:2406
#10 0xb5a87255 in key_press_event_cb (widget=0x8437c28, event=0x86d36e8)
    at ../../../../widget/src/gtk2/nsWindow.cpp:4699
#11 0xb7aabcfa in gtk_marshal_BOOLEAN__VOID ()
   from /usr/lib/libgtk-x11-2.0.so.0
#12 0xb77aadfd in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
...
Status: UNCONFIRMED → NEW
Ever confirmed: true
FWIW, I'm seeing this message when I close Print-Preview via these methods: 
 - Pressing 'escape'
 - Pressing 'alt+c'

But I *don't* see this message when I close Print-Preview via these methods:
 - First pressing 'tab', and then pressing either 'escape' or 'alt+c'
 - Tabbing to close button and pressing 'space' or 'enter'
 - Clicking close button
 - Clicking 'x' on the window's upper-right corner

Tested using a Linux debug build, checked out today (2008-04-10).
Component: XP Toolkit/Widgets: Menus → XUL
QA Contact: general → xptoolkit.widgets
[Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9.1a2pre) Gecko/20080825135339 Minefield/3.1a2pre] (home, debug default) (W2Ksp4)

Dedicated profile, dedicated run.
Assignee: general → jag
OS: Linux → All
Assignee: jag → nobody
Bug 500882 Part 7 removed the assertion:
https://hg.mozilla.org/mozilla-central/rev/e9921507713b
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: