Closed Bug 31750 Opened 24 years ago Closed 15 years ago

Interfaces must not have virtual destructors

Categories

(Core :: XPCOM, defect, P3)

defect

Tracking

()

RESOLVED INVALID

People

(Reporter: hjtoi-bugzilla, Unassigned)

Details

This pops up mostly in old interfaces that were created before XPIDL was there.

Interfaces must not have virtual destructors. If this were allowed, the vtable 
would contain the destructor, so in theory you could call the C++ destructor 
from, say, JavaScript, which is wrong. I am not sure if this actually breaks 
anything (inheritance?, impossible to call destructor?), but at least it wastes 
a little space.
Scott can you handle this.
Assignee: dp → scc
Status: NEW → ASSIGNED
Target Milestone: M16
another good thing to look for with the [XP]COM lint script.
Target Milestone: M16 → M20
mass re-assigning to my new bugzilla account
Assignee: scc → scc
Status: ASSIGNED → NEW
Status: NEW → ASSIGNED
Using this search

  <http://lxr.mozilla.org/seamonkey/search?string=virtual+%5C%7EnsI>

I found plenty of false hits and about 9 real cases

/intl/locale/src/windows/nsIWin32LocaleFactory.h, line 41 -- virtual 
~nsIWin32LocaleFactory(void);
/netwerk/cache/filecache/test/diskcache.cpp, line 76 -- virtual 
~nsITestDataStream() {};
/netwerk/test/TestCacheMgr.cpp, line 72 -- virtual ~nsITestDataStream() {};
/netwerk/test/TestRawCache.cpp, line 79 -- virtual ~nsITestDataStream() {};
/netwerk/test/TestWriteStream.cpp, line 45 -- virtual ~nsITestDataStream() {};
/htmlparser/src/nsIDTD.h, line 79 -- virtual ~nsIDTD() {};
/layout/html/table/src/nsITableLayoutStrategy.h, line 40 -- virtual 
~nsITableLayoutStrategy() {};
/layout/xul/base/src/nsIFrameBoxObject.cpp, line 38 -- virtual 
~nsIFrameBoxObject();
/widget/src/beos/nsWindow.h, line 248 -- virtual ~nsIWidgetStore();
QA Contact: leger → kandrot
I tried the search as described in Comment #4 

I saw that /netwerk/test/TestWriteStream.cpp, line 62 -- virtual
~nsITestDataStream() {}; is still there plus some dozen other cases.

How do I know if these are false hits or real cases?
QA Contact: kandrot → nobody
Assignee: scc → nobody
Status: ASSIGNED → NEW
QA Contact: nobody → xpcom
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.