Closed Bug 1034922 Opened 10 years ago Closed 9 years ago

Remove dangerous public destructor of nsSiteWindow

Categories

(Core :: XUL, defect)

Other Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla42
Tracking Status
firefox42 --- fixed

People

(Reporter: bjacob, Assigned: nika)

References

Details

Attachments

(1 file, 2 obsolete files)

In bug 1028588 we removed dangerous public destructors of XPCOM-refcounted classes outside of a finite whitelist, see HasDangerousPublicDestructor. Now we are going over the entries in this whitelist. One of them is: nsSiteWindow
nsSiteWindow is only used in one place as a helper because of clashing method names I think. For some reason, it's manually deleted in the parent class nsContentTreeOwner.
Hi, can I take up this bug?
For sure!
Attachment #8465757 - Flags: review?(hyatt)
Comment on attachment 8465757 [details] [diff] [review] Bug 1034922 - Remove Dangerous Public Destructor nsSiteWindow This seems to just remove the object. I don't think that's what we want to do.
Attachment #8465757 - Flags: review?(hyatt) → review-
I have to turn nsSiteWindow *mSiteWindow[1] into a nsRefPtr<> right? [1]http://mxr.mozilla.org/mozilla-central/source/xpfe/appshell/src/nsContentTreeOwner.h#54 If I do that it gives me the following errors: 2143: syntax error : missing ';' before '<' 2:26.76 c:\mozilla-central\xpfe\appshell\src\nsContentTreeOwner.h(54) : error C 4430: missing type specifier - int assumed. Note: C++ does not support default-i nt 2:26.77 c:\mozilla-central\xpfe\appshell\src\nsContentTreeOwner.h(54) : error C 2238: unexpected token(s) preceding ';' 2:26.77 c:\mozilla-central\xpfe\appshell\src\nsContentTreeOwner.cpp(79) : error C2065: 'mSiteWindow' : undeclared identifier 2:26.77 c:\mozilla-central\xpfe\appshell\src\nsContentTreeOwner.cpp(84) : error C2065: 'mSiteWindow' : undeclared identifier 2:26.78 c:\mozilla-central\xpfe\appshell\src\nsContentTreeOwner.cpp(84) : error C2541: 'delete' : cannot delete objects that are not pointers 2:26.78 c:\mozilla-central\xpfe\appshell\src\nsContentTreeOwner.cpp(111) : error C2065: 'mSiteWindow' : undeclared identifier Can someone tell me how should I remove these errors?
You probably need to include nsAutoPtr.h in the header. Does that help? Sorry nobody got back to you earlier.
Are you working on this?
Flags: needinfo?(rimjhim.mazumder17)
Hi Anuj, Yes I'm working on this bug. I apologize for taking so much time, but I'll submit a patch for this one soon. Could you take up some other bug?
Flags: needinfo?(rimjhim.mazumder17)
Hi, Debkanya - Are you still working on this?
This doesn't seem to have had work done on it in a while, so here's a simple patch to get rid of the need for HasDangerousPublicDestructor.
Attachment #8465757 - Attachment is obsolete: true
Attachment #8630820 - Flags: review?(enndeakin)
Assignee: nobody → michael
This updated patch changes the NS_DECL_ISUPPORTS to NS_DECL_ISUPPORTS_INHERITED, to avoid creating the unused mRefCnt member on nsSiteWindow.
Attachment #8630820 - Attachment is obsolete: true
Attachment #8630820 - Flags: review?(enndeakin)
Attachment #8630860 - Flags: review?(enndeakin)
nsSiteWindow is slightly odd compared to other users of NS_IMPL_ADDREF_WITH_AGGREGATOR, in that it isn't allocated inline within the original struct (like DOMCSSDeclarationImpl or nsCSSFontFaceStyleDecl). Code could be adjusted relatively easily to make the struct be inline, but it has the unfortunate consequence of forcing the nsSiteWindow object into the header file, as well as being more sketchy-seeming.
Attachment #8630860 - Flags: review?(enndeakin) → review+
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
Component: XP Toolkit/Widgets: XUL → XUL
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: