Closed
Bug 808146
Opened 11 years ago
Closed 11 years ago
nsProxyRelease.h:156:356: warning: deleting object of polymorphic class type ‘nsMainThreadPtrHolder<nsIUrlClassifierLookupCallback>’ which has non-virtual destructor might cause undefined behaviour [-Wdelete-non-virtual-dtor]
Categories
(Core :: XPCOM, defect)
Tracking
()
RESOLVED
FIXED
mozilla19
Tracking | Status | |
---|---|---|
b2g18 | --- | fixed |
People
(Reporter: dholbert, Assigned: dholbert)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
1.10 KB,
patch
|
bholley
:
review+
|
Details | Diff | Splinter Review |
Just noticed this mess of warning-spam, when building in url-classifier: { nsUrlClassifierDBService.cpp In file included from /scratch/work/builds/mozilla-central/mozilla-central.10-12-09.12-05/mozilla/toolkit/components/url-classifier/nsUrlClassifierProxies.h:10:0, from /scratch/work/builds/mozilla-central/mozilla-central.10-12-09.12-05/mozilla/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp:23: ../../../dist/include/nsProxyRelease.h: In instantiation of ‘nsrefcnt nsMainThreadPtrHolder<T>::Release() [with T = nsIUrlClassifierLookupCallback; nsrefcnt = unsigned int]’: ../../../dist/include/nsAutoPtr.h:874:13: required from ‘nsRefPtr<T>::~nsRefPtr() [with T = nsMainThreadPtrHolder<nsIUrlClassifierLookupCallback>]’ ../../../dist/include/nsProxyRelease.h:159:7: required from here ../../../dist/include/nsProxyRelease.h:156:356: warning: deleting object of polymorphic class type ‘nsMainThreadPtrHolder<nsIUrlClassifierLookupCallback>’ which has non-virtual destructor might cause undefined behaviour [-Wdelete-non-virtual-dtor] ../../../dist/include/nsProxyRelease.h: In instantiation of ‘nsrefcnt nsMainThreadPtrHolder<T>::Release() [with T = nsIUrlClassifierCallback; nsrefcnt = unsigned int]’: ../../../dist/include/nsAutoPtr.h:874:13: required from ‘nsRefPtr<T>::~nsRefPtr() [with T = nsMainThreadPtrHolder<nsIUrlClassifierCallback>]’ ../../../dist/include/nsProxyRelease.h:159:7: required from here ../../../dist/include/nsProxyRelease.h:156:356: warning: deleting object of polymorphic class type ‘nsMainThreadPtrHolder<nsIUrlClassifierCallback>’ which has non-virtual destructor might cause undefined behaviour [-Wdelete-non-virtual-dtor] ../../../dist/include/nsProxyRelease.h: In instantiation of ‘nsrefcnt nsMainThreadPtrHolder<T>::Release() [with T = nsIUrlClassifierUpdateObserver; nsrefcnt = unsigned int]’: ../../../dist/include/nsAutoPtr.h:874:13: required from ‘nsRefPtr<T>::~nsRefPtr() [with T = nsMainThreadPtrHolder<nsIUrlClassifierUpdateObserver>]’ ../../../dist/include/nsProxyRelease.h:159:7: required from here ../../../dist/include/nsProxyRelease.h:156:356: warning: deleting object of polymorphic class type ‘nsMainThreadPtrHolder<nsIUrlClassifierUpdateObserver>’ which has non-virtual destructor might cause undefined behaviour [-Wdelete-non-virtual-dtor] nsUrlClassifierProxies.cpp In file included from /scratch/work/builds/mozilla-central/mozilla-central.10-12-09.12-05/mozilla/toolkit/components/url-classifier/nsUrlClassifierProxies.h:10:0, from /scratch/work/builds/mozilla-central/mozilla-central.10-12-09.12-05/mozilla/toolkit/components/url-classifier/nsUrlClassifierProxies.cpp:6: ../../../dist/include/nsProxyRelease.h: In instantiation of ‘nsrefcnt nsMainThreadPtrHolder<T>::Release() [with T = nsIUrlClassifierLookupCallback; nsrefcnt = unsigned int]’: ../../../dist/include/nsAutoPtr.h:874:13: required from ‘nsRefPtr<T>::~nsRefPtr() [with T = nsMainThreadPtrHolder<nsIUrlClassifierLookupCallback>]’ ../../../dist/include/nsProxyRelease.h:159:7: required from here ../../../dist/include/nsProxyRelease.h:156:356: warning: deleting object of polymorphic class type ‘nsMainThreadPtrHolder<nsIUrlClassifierLookupCallback>’ which has non-virtual destructor might cause undefined behaviour [-Wdelete-non-virtual-dtor] ../../../dist/include/nsProxyRelease.h: In instantiation of ‘nsrefcnt nsMainThreadPtrHolder<T>::Release() [with T = nsIUrlClassifierCallback; nsrefcnt = unsigned int]’: ../../../dist/include/nsAutoPtr.h:874:13: required from ‘nsRefPtr<T>::~nsRefPtr() [with T = nsMainThreadPtrHolder<nsIUrlClassifierCallback>]’ ../../../dist/include/nsProxyRelease.h:159:7: required from here ../../../dist/include/nsProxyRelease.h:156:356: warning: deleting object of polymorphic class type ‘nsMainThreadPtrHolder<nsIUrlClassifierCallback>’ which has non-virtual destructor might cause undefined behaviour [-Wdelete-non-virtual-dtor] ../../../dist/include/nsProxyRelease.h: In instantiation of ‘nsrefcnt nsMainThreadPtrHolder<T>::Release() [with T = nsIUrlClassifierUpdateObserver; nsrefcnt = unsigned int]’: ../../../dist/include/nsAutoPtr.h:874:13: required from ‘nsRefPtr<T>::~nsRefPtr() [with T = nsMainThreadPtrHolder<nsIUrlClassifierUpdateObserver>]’ ../../../dist/include/nsProxyRelease.h:159:7: required from here ../../../dist/include/nsProxyRelease.h:156:356: warning: deleting object of polymorphic class type ‘nsMainThreadPtrHolder<nsIUrlClassifierUpdateObserver>’ which has non-virtual destructor might cause undefined behaviour [-Wdelete-non-virtual-dtor] } Easy to fix -- we just need to declare nsMainThreadPtrHolder as MOZ_FINAL, so the compiler doesn't worry about potential subclasses trying & failing to override its destructor.
Assignee | ||
Comment 1•11 years ago
|
||
Attachment #677852 -
Flags: review?(bobbyholley+bmo)
Assignee | ||
Updated•11 years ago
|
Assignee: nobody → dholbert
Status: NEW → ASSIGNED
Assignee | ||
Updated•11 years ago
|
Blocks: buildwarning
Assignee | ||
Comment 2•11 years ago
|
||
FWIW, this warning started with the landing of bug 795281, which added the first instantiation of nsMainThreadPtrHolder<> into the tree.
Depends on: 795281
Updated•11 years ago
|
Attachment #677852 -
Flags: review?(bobbyholley+bmo) → review+
Comment 3•11 years ago
|
||
Yeah, that was one of the patches from a big patch stack I had, but gcp landed it earlier to fix some other stuff. I'm pretty sure this fix is also somewhere in my stack, but please go ahead and land this. Sorry for the trouble. :-)
Assignee | ||
Comment 4•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/7b2ba9e2d17f
Comment 5•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/7b2ba9e2d17f
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Target Milestone: --- → mozilla19
Comment 6•11 years ago
|
||
https://hg.mozilla.org/releases/mozilla-b2g18/rev/ea47019235c0
status-b2g18:
--- → fixed
You need to log in
before you can comment on or make changes to this bug.
Description
•