Closed Bug 810495 Opened 12 years ago Closed 9 years ago

Make the classes which use the XPCOM nsISupports implementation macros final, to avoid the warning about deleting using a pointer to a base class with virtual functions and no virtual dtor

Categories

(MailNews Core :: Backend, defect)

defect
Not set
normal

Tracking

(thunderbird40 fixed)

RESOLVED FIXED
Thunderbird 40.0
Tracking Status
thunderbird40 --- fixed

People

(Reporter: Irving, Assigned: aceman)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

+++ This bug was initially created as a clone of Bug #758992 +++

This warning generates ridiculous amount of spam and isn't really useful.

Make changes like those in bug 758992 to Thunderbird
Assignee: nobody → acelists
Version: unspecified → Trunk
I am not sure how to fix those that are hidden in NS_IMPL_THREADSAFE_ISUPPORTS* macros.
If there are any such remaining classes like comment 1, can you provide an example? MXR isn't finding any for me at http://mxr.mozilla.org/comm-central/search?string=NS_IMPL_THREADSAFE_ISUPPORTS

(Though per bug 1146094 comment 2, it sounds like maybe this is no longer an issue.)
It seems there are these remaining warnings about this problem when building TB:

mailnews/imap/src/nsAutoSyncManager.cpp: In member function 'virtual MozExternalRefCountType nsDefaultAutoSyncMsgStrategy::Release()':
../../../dist/include/nsISupportsImpl.h:647:52: warning: deleting object of polymorphic class type 'nsDefaultAutoSyncMsgStrategy' which has non-virtual destructor might cause undefined beh
aviour [-Wdelete-non-virtual-dtor]
   NS_IMPL_RELEASE_WITH_DESTROY(_class, delete (this))

mailnews/imap/src/nsAutoSyncManager.cpp:24:1: note: in expansion of macro 'NS_IMPL_ISUPPORTS'
 NS_IMPL_ISUPPORTS(nsDefaultAutoSyncMsgStrategy, nsIAutoSyncMsgStrategy)
 ^
/var/SSD/TB-hg/mailnews/imap/src/nsAutoSyncManager.cpp: In member function 'virtual MozExternalRefCountType nsDefaultAutoSyncFolderStrategy::Release()':
../../../dist/include/nsISupportsImpl.h:647:52: warning: deleting object of polymorphic class type 'nsDefaultAutoSyncFolderStrategy' which has non-virtual destructor might cause undefined
behaviour [-Wdelete-non-virtual-dtor]
   NS_IMPL_RELEASE_WITH_DESTROY(_class, delete (this))

mailnews/imap/src/nsAutoSyncManager.cpp:111:1: note: in expansion of macro 'NS_IMPL_ISUPPORTS'
 NS_IMPL_ISUPPORTS(nsDefaultAutoSyncFolderStrategy, nsIAutoSyncFolderStrategy)
 ^
/var/SSD/TB-hg/mailnews/imap/src/nsAutoSyncManager.cpp: In member function 'virtual MozExternalRefCountType nsAutoSyncManager::Release()':
../../../dist/include/nsISupportsImpl.h:647:52: warning: deleting object of polymorphic class type 'nsAutoSyncManager' which has non-virtual destructor might cause undefined behaviour [-Wd
elete-non-virtual-dtor]
   NS_IMPL_RELEASE_WITH_DESTROY(_class, delete (this))

mailnews/imap/src/nsAutoSyncState.cpp: In member function 'virtual MozExternalRefCountType nsAutoSyncState::Release()':
../../../dist/include/nsISupportsImpl.h:647:52: warning: deleting object of polymorphic class type 'nsAutoSyncState' which has non-virtual destructor might cause undefined behaviour [-Wdel
ete-non-virtual-dtor]
   NS_IMPL_RELEASE_WITH_DESTROY(_class, delete (this))

mailnews/extensions/fts3/src/nsFts3Tokenizer.cpp: In member function 'virtual MozExternalRefCountType nsFts3Tokenizer::Release()':
../../../../dist/include/nsISupportsImpl.h:647:52: warning: deleting object of polymorphic class type 'nsFts3Tokenizer' which has non-virtual destructor might cause undefined behaviour [-W
delete-non-virtual-dtor]
   NS_IMPL_RELEASE_WITH_DESTROY(_class, delete (this))

mailnews/extensions/fts3/src/nsGlodaRankerFunction.cpp: In member function 'virtual MozExternalRefCountType nsGlodaRankerFunction::Release()':
../../../../dist/include/nsISupportsImpl.h:647:52: warning: deleting object of polymorphic class type 'nsGlodaRankerFunction' which has non-virtual destructor might cause undefined behavio
ur [-Wdelete-non-virtual-dtor]
   NS_IMPL_RELEASE_WITH_DESTROY(_class, delete (this))

mailnews/base/src/nsMsgFolderNotificationService.cpp: In member function 'virtual MozExternalRefCountType nsMsgFolderNotificationService::Release()':
../../../dist/include/nsISupportsImpl.h:647:52: warning: deleting object of polymorphic class type 'nsMsgFolderNotificationService' which has non-virtual destructor might cause undefined b
ehaviour [-Wdelete-non-virtual-dtor]
   NS_IMPL_RELEASE_WITH_DESTROY(_class, delete (this))

mail/components/migration/src/nsProfileMigrator.cpp: In member function 'virtual MozExternalRefCountType nsProfileMigrator::Release()':
../../../../dist/include/nsISupportsImpl.h:647:52: warning: deleting object of polymorphic class type 'nsProfileMigrator' which has non-virtual destructor might cause undefined behaviour [
-Wdelete-non-virtual-dtor]
   NS_IMPL_RELEASE_WITH_DESTROY(_class, delete (this))

ldap/xpcom/src/nsLDAPBERElement.cpp: In member function 'virtual MozExternalRefCountType nsLDAPBERElement::Release()':
../../../dist/include/nsISupportsImpl.h:647:52: warning: deleting object of polymorphic class type 'nsLDAPBERElement' which has non-virtual destructor might cause undefined behaviour [-Wde
lete-non-virtual-dtor]
   NS_IMPL_RELEASE_WITH_DESTROY(_class, delete (this))
Attached patch 810495.patchSplinter Review
Attachment #8581353 - Flags: review?(Pidgeot18)
I have still noticed these, which are in some macro.

mailnews/extensions/fts3/src/nsGlodaRankerFunction.cpp: In member function 'virtual MozExternalRefCountType nsGlodaRankerFunction::Release()':
../../../../dist/include/nsISupportsImpl.h:647:52: warning: deleting object of polymorphic class type 'nsGlodaRankerFunction' which has non-virtual destructor might cause undefined behaviour [-Wdelete-non-virtual-dtor]
   NS_IMPL_RELEASE_WITH_DESTROY(_class, delete (this))
                                                    ^
../../../../dist/include/nsISupportsImpl.h:627:5: note: in definition of macro 'NS_IMPL_RELEASE_WITH_DESTROY'
     _destroy;                                                                 \
     ^
../../../../dist/include/nsISupportsImpl.h:1039:3: note: in expansion of macro 'NS_IMPL_RELEASE'
   NS_IMPL_RELEASE(aClass)                                                     \
   ^
/var/SSD/TB-hg/mailnews/extensions/fts3/src/nsGlodaRankerFunction.cpp:50:1: note: in expansion of macro 'NS_IMPL_ISUPPORTS'
 NS_IMPL_ISUPPORTS(nsGlodaRankerFunction, mozIStorageFunction)

Dholbert, do you know what to do with those?
Flags: needinfo?(dholbert)
I think this line:
> class nsGlodaRankerFunction : public mozIStorageFunction
just needs to change to:
> class nsGlodaRankerFunction final : public mozIStorageFunction

MXR link:
http://mxr.mozilla.org/comm-central/source/mailnews/extensions/fts3/src/nsGlodaRankerFunction.h#11

Does that fix this?
Flags: needinfo?(dholbert)
Yeah, thanks!
Attachment #8581353 - Flags: review?(Pidgeot18) → review+
Thanks.
Status: NEW → ASSIGNED
Keywords: checkin-needed
https://hg.mozilla.org/comm-central/rev/05c47091340d
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 40.0
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: