Closed
Bug 201891
Opened 21 years ago
Closed 21 years ago
Lazily instantiate CSSFrameConstructor::gXBLService
Categories
(Core :: Layout, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: mscott, Assigned: dbaron)
Details
Attachments
(1 file, 1 obsolete file)
3.65 KB,
patch
|
Details | Diff | Splinter Review |
This is fall out from Bug #194568 where creating two separate instances of the XBL service leads to an infinite loop. We'd like to break the cycle described in that bug. This means lazily instantiating CSSFrameConstructor::gXBLService, so we don't create it when the layout module is loaded. I'll attach a non optimal patch which I used to make sure this fixes an infinite loop I run into with Minotaur.
Reporter | ||
Comment 1•21 years ago
|
||
Here's a test patch I used to make sure this fixed the problem I was seeing. I removed the call to InitGlobals when the layout module is loaded. I added a new static method called GetXBLService which initializes and returns gXBLSerice. (it does not reference the object on the return). Replaced the callers of gXBLService with GetXBLService. ReleaseGlobals is still called from the layout module when it is being unloaded. that's the one part that still seems weird with this test patch of mine. We have a method called GetXBLService which is paired with a ReleaseGlobals method. A naming inconsistency.
Reporter | ||
Comment 2•21 years ago
|
||
David, can you comment about how you'd like to see this fixed? Read my comments above about why I think my patch may not be appropriate to be checked in. I'd like your input on how you'd like to resolve the inconsistency of when we instantiate and when we release the XBL service.
Comment 3•21 years ago
|
||
Scott, I see a crash with a NULL gXULCache in this case, why are you seeing an infinite loop? The OS/2 Tbird build crashes at startup on the first invocation.
Assignee | ||
Comment 4•21 years ago
|
||
Comment on attachment 120397 [details] [diff] [review] a possible patch The inconistency doesn't bother me. We do that kind of thing all over the place. A few comments on the patch, though: >Index: html/style/src/nsCSSFrameConstructor.cpp >@@ -1370,6 +1370,18 @@ > return NS_OK; > } > >+nsIXBLService * nsCSSFrameConstructor::GetXBLService() >+{ >+ nsresult rv = NS_OK; >+ if (!gXBLService) >+ rv = CallGetService("@mozilla.org/xbl;1", &gXBLService); >+ >+ if (NS_SUCCEEDED(rv)) >+ return gXBLService; >+ else >+ return NULL; Why not make this a little simpler by doing: if (!gXBLService) { nsresult rv = CallGetService("@mozilla.org/xbl;1", &gXBLService); if (NS_FAILED(rv)) gXBLService = nsnull; } return gXBLService; >Index: html/style/src/nsCSSFrameConstructor.h >+ static nsresult InitGlobals() { if (!gXBLService) return CallGetService("@mozilla.org/xbl;1", &gXBLService); else return NS_OK; } Nothing's calling this anymore, so get rid of it.
Attachment #120397 -
Flags: superreview+
Attachment #120397 -
Flags: review+
Reporter | ||
Comment 5•21 years ago
|
||
Thanks David, I'll update the patch tonight with the suggestions you made then drive it into the tree.
Reporter | ||
Comment 6•21 years ago
|
||
Attachment #120397 -
Attachment is obsolete: true
Reporter | ||
Comment 7•21 years ago
|
||
This has been checked in. Mike did I just read in your bug comment that you have thunderbird running on OS2? That's pretty cool. I'm not sure why OS2 was crashing. On windows and linux, we spun in an infinite loop. See the discussion in Bug #194568 for information about why.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Comment 8•21 years ago
|
||
if NS_FAILED(rv) for CallGetService, isn't gXBLService always going to be nsnull? If not, should we fix CallGetService (and/or |::GetService(ByContractID)|) to make that assumption true?
You need to log in
before you can comment on or make changes to this bug.
Description
•