In member function 'virtual nsrefcnt nsSecurityConsoleMessage::Release()': warning: deleting object of polymorphic class type 'nsSecurityConsoleMessage' which has non-virtual destructor might cause undefined behaviour [-Wdelete-non-virtual-dtor]

RESOLVED FIXED in mozilla27

Status

()

defect
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: dholbert, Assigned: dholbert)

Tracking

(Blocks 1 bug)

Trunk
mozilla27
x86_64
Linux
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite -

Firefox Tracking Flags

(Not tracked)

Details

Just noticed this build warning:
{
 3:19.54 In file included from ../../dist/include/nsISupportsUtils.h:26:0,
 3:19.54                  from ../../dist/include/nsISupports.h:123,
 3:19.54                  from ../../dist/include/nsISecurityConsoleMessage.h:10,
 3:19.54                  from /scratch/work/builds/mozilla-inbound/mozilla/xpcom/base/nsSecurityConsoleMessage.h:7,
 3:19.54                  from /scratch/work/builds/mozilla-inbound/mozilla/xpcom/base/nsSecurityConsoleMessage.cpp:5:
 3:19.55 /scratch/work/builds/mozilla-inbound/mozilla/xpcom/base/nsSecurityConsoleMessage.cpp: In member function 'virtual nsrefcnt nsSecurityConsoleMessage::Release()':
 3:19.55 Warning: -Wdelete-non-virtual-dtor in /scratch/work/builds/mozilla-inbound/obj/dist/include/nsISupportsImpl.h: deleting object of polymorphic class type 'nsSecurityConsoleMessage' which has non-virtual destructor might cause undefined behaviour
 3:19.55 ../../dist/include/nsISupportsImpl.h:494:52: warning: deleting object of polymorphic class type 'nsSecurityConsoleMessage' which has non-virtual destructor might cause undefined behaviour [-Wdelete-non-virtual-dtor]
 3:19.55    NS_IMPL_RELEASE_WITH_DESTROY(_class, delete (this))
 3:19.55                                                     ^
 3:19.55 ../../dist/include/nsISupportsImpl.h:474:5: note: in definition of macro 'NS_IMPL_RELEASE_WITH_DESTROY'
 3:19.55      _destroy;                                                                 \
 3:19.55      ^
 3:19.55 ../../dist/include/nsISupportsImpl.h:1220:3: note: in expansion of macro 'NS_IMPL_RELEASE'
 3:19.55    NS_IMPL_RELEASE(_class)                                                     \
 3:19.55    ^
 3:19.55 /scratch/work/builds/mozilla-inbound/mozilla/xpcom/base/nsSecurityConsoleMessage.cpp:7:1: note: in expansion of macro 'NS_IMPL_ISUPPORTS1'
 3:19.55  NS_IMPL_ISUPPORTS1(nsSecurityConsoleMessage, nsISecurityConsoleMessage)
 3:19.55  ^
}

This just needs a MOZ_FINAL annotation on the class.

Planning on fixing this with my blanket rs=ehsan, granted over in bug 829975 comment 3.

[marking dependency on bug 846918, since this code was added there, though I'm not sure why I only noticed the warning for the first time today.]
https://hg.mozilla.org/mozilla-central/rev/fba44ae0de48
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla27
You need to log in before you can comment on or make changes to this bug.