Closed Bug 334556 Opened 19 years ago Closed 19 years ago

crash on startup when GTK accessibility pref enabled

Categories

(Core :: Disability Access APIs, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: dbaron, Assigned: aaronlev)

References

Details

(Keywords: access, fixed1.8.1)

Attachments

(4 files, 1 obsolete file)

I crash on startup when the GTK accessibility pref is enabled because the root accessible object is destroyed within its own constructor, at the stack to be attached. This is in a trunk build from within the past few hours. I suspect this is a regression from bug 333134 -- specifically the change to nsDocAccessible.cpp. However, that change is correct -- you just need more of the same. It's against the rules in Mozilla code to pass an object around from its own constructor, for two reasons: * you crash if something AddRefs and Releases it, since the reference count goes from 0 to 1 to 0 again * not all the vtable pointers are initialized, so strange things can happen (destructors have the same problem). This is what confused the leak logging and caused the appearance of a negative leak that I'm guessing you were fixing in bug 333134's changes to nsDocAccessible.cpp. I can see backing out that change temporarily to fix this, but in the long term you want to move forward by not passing |this| around from constructors or destructors.
Blocks: fox2access
Attached patch Untested (obsolete) — Splinter Review
I'm not getting the crash myself, but this might fix the problem. David, want to test it?
Attachment #218923 - Flags: review?(ginn.chen)
Comment on attachment 218923 [details] [diff] [review] Untested It solved the crash, but firefox is not accessible. In at-poke, no accessible window under firefox application. Backing out accessible/src/base/nsDocAccessible.cpp can solve this bug.
Attachment #218923 - Flags: review?(ginn.chen) → review-
Attached patch patch v2Splinter Review
Attachment #218923 - Attachment is obsolete: true
Attachment #218956 - Flags: review?(aaronleventhal)
Comment on attachment 218956 [details] [diff] [review] patch v2 Oh I forget the upcall, good catch. Very close.
Attachment #218956 - Flags: review?(aaronleventhal) → review-
Attachment #218967 - Flags: review?(ginn.chen)
I had accidentally posted this comment to bug 331120: The only place in the constructor chain for nsRootAccessible that we pass |this| around is here: http://lxr.mozilla.org/seamonkey/source/accessible/src/atk/nsRootAccessibleWrap.cpp#49 Ginn, I think we need to move that into nsRootAccessibleWrap::Init() While we're at it the code in the destructor needs to be moved to the Shutdown() method. Most things should happen in Shutdown() not in the destructor because we're guaranteed that Shutdown() will be called when a DOM Node is no longer needed. Unfortunately the refcount might not be 0 because a poorly behaving accessibility user might not release when we want them to. Looks like we'll have to go through the mozilla/accessible/atk and ensure proper use of Init() and Shutdown() instead of constructor and destructor code.
Comment on attachment 218967 [details] [diff] [review] Upcall for nsRootAccessible::Init() & Shutdown() r=me please don't change -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +N/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ and we don't use rv so we don't need rv + nsresult rv = nsRootAccessible::Init();
Attachment #218967 - Flags: review?(ginn.chen) → review+
Attachment #218970 - Flags: superreview?(dbaron)
Attachment #218970 - Flags: superreview?(dbaron)
Comment on attachment 218970 [details] [diff] [review] Don't forget to return rv Ginn, does this build for you?
Attachment #218970 - Flags: review?(ginn.chen)
Comment on attachment 218970 [details] [diff] [review] Don't forget to return rv Verified that it builds and works.
Attachment #218970 - Flags: superreview?(dbaron)
Attachment #218970 - Flags: review?(ginn.chen)
Attachment #218970 - Flags: review+
Attachment #218970 - Flags: superreview?(dbaron) → superreview+
Checking in src/atk/nsRootAccessibleWrap.cpp; /cvsroot/mozilla/accessible/src/atk/nsRootAccessibleWrap.cpp,v <-- nsRootAccessibleWrap.cpp new revision: 1.8; previous revision: 1.7 done Checking in src/atk/nsRootAccessibleWrap.h; /cvsroot/mozilla/accessible/src/atk/nsRootAccessibleWrap.h,v <-- nsRootAccessibleWrap.h new revision: 1.8; previous revision: 1.7 done
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Attachment #218970 - Flags: approval-branch-1.8.1+
Keywords: access, fixed1.8.1
Comment on attachment 218970 [details] [diff] [review] Don't forget to return rv This has to go in at the same time as its sister, bug 333134.
Attachment #218970 - Flags: approval1.8.0.3?
Comment on attachment 218970 [details] [diff] [review] Don't forget to return rv approved for 1.8.0 branch, a=dveditz for drivers
Attachment #218970 - Flags: approval1.8.0.3? → approval1.8.0.3+
It seems safer to me to skip this, and the part of the other patch that caused it, for 1.8.0.3.
Comment on attachment 218970 [details] [diff] [review] Don't forget to return rv Removing approval since for now we're deciding not to check this in, on dbaron's advice.
Attachment #218970 - Flags: approval1.8.0.4+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: