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)
Core
CSS Parsing and Computation
Tracking
()
RESOLVED
FIXED
People
(Reporter: timeless, Assigned: jaas)
References
Details
(Keywords: assertion)
Attachments
(1 file, 2 obsolete files)
6.49 KB,
patch
|
dbaron
:
review+
dbaron
:
superreview+
|
Details | Diff | Splinter Review |
[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)
Comment 1•18 years ago
|
||
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.
Comment 3•18 years ago
|
||
OK. So we should add static Init and Destroy or some such to nsCSSRendering. Sound ok?
Sure.
Comment 6•18 years ago
|
||
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.
Comment 7•18 years ago
|
||
(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.
Attachment #258507 -
Attachment is obsolete: true
Attachment #258511 -
Flags: review?(dbaron)
Attachment #258507 -
Flags: review?(dbaron)
Comment 10•18 years ago
|
||
Put this inside nsLayoutStatics? That's where all this sort of thing lives.
Assignee | ||
Comment 11•18 years ago
|
||
bz - put what inside of nsLayoutStatistics?
Assignee | ||
Comment 12•18 years ago
|
||
nm, I get it. patch coming up.
Attachment #258511 -
Flags: review?(dbaron)
Attachment #258511 -
Attachment is obsolete: true
Assignee | ||
Comment 13•18 years ago
|
||
Attachment #258572 -
Flags: review?(dbaron)
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+
Assignee | ||
Comment 15•18 years ago
|
||
fixed on trunk
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Updated•18 years ago
|
Flags: blocking1.9? → in-testsuite?
You need to log in
before you can comment on or make changes to this bug.
Description
•