Closed Bug 373305 Opened 18 years ago Closed 18 years ago

static InlineBackgroundData instance containing nsRect in layout triggering runtime static ctor/dtor warnings

Categories

(Core :: CSS Parsing and Computation, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: timeless, Assigned: jaas)

References

Details

(Keywords: assertion)

Attachments

(1 file, 2 obsolete files)

[XPCOM objects created/destroyed from static ctor/dtor] (gActivityTLS != BAD_TLS_INDEX && NS_PTR_TO_INT32(PR_Get ThreadPrivate(gActivityTLS)) == 0) gkgfx!nsRect::nsRect gklayout!InlineBackgroundData::InlineBackgroundData gklayout!`dynamic initializer for 'gInlineBGData''(void)+0xd static InlineBackgroundData gInlineBGData; (nsCSSRendering.cpp)
We can allocate/deallocate this in the module ctor/dtor, if it doesn't go away entirely with cairo-ization of nsCSSRendering.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: blocking1.9?
It won't go away unless we regress what it does.
OK. So we should add static Init and Destroy or some such to nsCSSRendering. Sound ok?
Attached patch fix v1.0 (obsolete) — Splinter Review
Assignee: dbaron → joshmoz
Status: NEW → ASSIGNED
Attachment #258507 - Flags: review?(dbaron)
Comment on attachment 258507 [details] [diff] [review] fix v1.0 >Index: base/nsCSSRendering.cpp >+nsresult nsCSSRendering::Initialize() >+{ >+ if (!gInlineBGData) >+ gInlineBGData = new InlineBackgroundData; >+ >+ return NS_OK; >+} If this always returns NS_OK, why not make it void -- except that allocation can fail, so you should check for OOM here. >+nsresult nsCSSRendering::Destroy() >+{ >+ if (gInlineBGData) { >+ delete gInlineBGData; >+ gInlineBGData = nsnull; >+ } >+ >+ return NS_OK; >+} This can't fail -- just make it void.
(In reply to comment #6) > >+nsresult nsCSSRendering::Destroy() > >+{ > >+ if (gInlineBGData) { > >+ delete gInlineBGData; > >+ gInlineBGData = nsnull; > >+ } > >+ > >+ return NS_OK; > >+} Also, since delete is null-safe, you could remove the if if you wanted.
As for return values, I thought about doing void but I followed the example set in another situation.
Attached patch fix v1.1 (obsolete) — Splinter Review
Attachment #258507 - Attachment is obsolete: true
Attachment #258511 - Flags: review?(dbaron)
Attachment #258507 - Flags: review?(dbaron)
Put this inside nsLayoutStatics? That's where all this sort of thing lives.
bz - put what inside of nsLayoutStatistics?
nm, I get it. patch coming up.
Attachment #258511 - Flags: review?(dbaron)
Attachment #258511 - Attachment is obsolete: true
Attached patch fix v1.2Splinter Review
Attachment #258572 - Flags: review?(dbaron)
OS: Windows XP → All
Hardware: PC → All
Comment on attachment 258572 [details] [diff] [review] fix v1.2 >+nsresult nsCSSRendering::Init() >+{ >+ if (!gInlineBGData) >+ gInlineBGData = new InlineBackgroundData; Change this to NS_ASSERTION(!gInlineBGData, "Init called twice"); gInlineBGData = new InlineBackgroundData(); and r+sr=dbaron.
Attachment #258572 - Flags: superreview+
Attachment #258572 - Flags: review?(dbaron)
Attachment #258572 - Flags: review+
fixed on trunk
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Flags: blocking1.9? → in-testsuite?
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: