Closed Bug 867420 Opened 6 years ago Closed 6 years ago

AsyncPanZoomController.h & CompositorParent.cpp triggers build warning: deleting object of polymorphic class type 'mozilla::layers::AsyncCompositionManager' which has non-virtual destructor might cause undefined behaviour [-Wdelete-non-virtual-dtor]

Categories

(Core :: Graphics, defect)

x86_64
Linux
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla23

People

(Reporter: dholbert, Assigned: dholbert)

References

(Blocks 1 open bug)

Details

New GCC build warning (I'm using GCC 4.8):
{
In file included from /mozilla-central/gfx/layers/ipc/AsyncPanZoomController.h:13:0,
                 from /mozilla-central/gfx/layers/ipc/CompositorParent.cpp:11:
../../dist/include/mozilla/RefPtr.h: In instantiation of 'void mozilla::RefCounted<T>::Release() [with T = mozilla::layers::AsyncCompositionManager]':
../../dist/include/mozilla/RefPtr.h:171:9:   required from 'static void mozilla::RefPtr<T>::unref(T*) [with T = mozilla::layers::AsyncCompositionManager]'
../../dist/include/mozilla/RefPtr.h:121:26:   required from 'mozilla::RefPtr<T>::~RefPtr() [with T = mozilla::layers::AsyncCompositionManager]'
/mozilla-central/gfx/layers/ipc/CompositorParent.cpp:139:34:   required from here
../../dist/include/mozilla/RefPtr.h:76:9: warning: deleting object of polymorphic class type 'mozilla::layers::AsyncCompositionManager' which has non-virtual destructor might cause undefined behaviour [-Wdelete-non-virtual-dtor]
         delete static_cast<T*>(this);
         ^
}

This can be fixed by a MOZ_FINAL annotation (which tells the compiler we don't have to worry about there being any subclasses, so we don't need a virtual destructor).  I'll push
that with blanket-r=ehsan, per bug 829975 comment 3.
https://hg.mozilla.org/integration/mozilla-inbound/rev/3d939baa396b
Assignee: nobody → dholbert
Status: NEW → ASSIGNED
Flags: in-testsuite-
https://hg.mozilla.org/mozilla-central/rev/3d939baa396b
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla23
You need to log in before you can comment on or make changes to this bug.