[vlc-commits] [Git][videolan/vlc][master] 2 commits: decklink: add default virtual destructor
Hugo Beauzée-Luyssen (@chouquette)
gitlab at videolan.org
Wed Feb 9 16:27:52 UTC 2022
Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC
Commits:
6836caf0 by Alexandre Janniaux at 2022-02-09T14:28:31+00:00
decklink: add default virtual destructor
The class has virtual functions and is calling `delete this;` so it
triggers a warning if the class has no virtual destructors.
modules/access/decklink.cpp: In member function ‘virtual ULONG {anonymous}::DeckLinkCaptureDelegate::Release()’:
modules/access/decklink.cpp:268:13: warning: deleting object of polymorphic class type ‘{anonymous}::DeckLinkCaptureDelegate’ which has non-virtual destructor might cause undefined behavior [-Wdelete-non-virtual-dtor]
268 | delete this;
| ^~~~~~~~~~~
- - - - -
2e44d338 by Alexandre Janniaux at 2022-02-09T14:28:31+00:00
decklink: use override for virtual functions
override will ensure that the functions have the correct signature
compared to the interface they are implemented against.
- - - - -
1 changed file:
- modules/access/decklink.cpp
Changes:
=====================================
modules/access/decklink.cpp
=====================================
@@ -253,15 +253,16 @@ public:
{
m_ref_.store(1);
}
+ virtual ~DeckLinkCaptureDelegate() = default;
- virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID, LPVOID *) { return E_NOINTERFACE; }
+ HRESULT STDMETHODCALLTYPE QueryInterface(REFIID, LPVOID *) override { return E_NOINTERFACE; }
- virtual ULONG STDMETHODCALLTYPE AddRef(void)
+ ULONG STDMETHODCALLTYPE AddRef(void) override
{
return m_ref_.fetch_add(1);
}
- virtual ULONG STDMETHODCALLTYPE Release(void)
+ ULONG STDMETHODCALLTYPE Release(void) override
{
uintptr_t new_ref = m_ref_.fetch_sub(1);
if (new_ref == 0)
@@ -269,7 +270,10 @@ public:
return new_ref;
}
- virtual HRESULT STDMETHODCALLTYPE VideoInputFormatChanged(BMDVideoInputFormatChangedEvents events, IDeckLinkDisplayMode *mode, BMDDetectedVideoInputFormatFlags flags)
+ HRESULT STDMETHODCALLTYPE
+ VideoInputFormatChanged(BMDVideoInputFormatChangedEvents events,
+ IDeckLinkDisplayMode *mode,
+ BMDDetectedVideoInputFormatFlags flags) override
{
demux_sys_t *sys = static_cast<demux_sys_t *>(demux_->p_sys);
@@ -316,7 +320,9 @@ public:
return S_OK;
}
- virtual HRESULT STDMETHODCALLTYPE VideoInputFrameArrived(IDeckLinkVideoInputFrame*, IDeckLinkAudioInputPacket*);
+ HRESULT STDMETHODCALLTYPE
+ VideoInputFrameArrived(IDeckLinkVideoInputFrame*,
+ IDeckLinkAudioInputPacket*) override;
private:
std::atomic_uint m_ref_;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/3a526cb35e8ce5494597bbd3d0be2804b8ddbcbd...2e44d338763f72a30a7f5631f86d73c2fc58397e
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/3a526cb35e8ce5494597bbd3d0be2804b8ddbcbd...2e44d338763f72a30a7f5631f86d73c2fc58397e
You're receiving this email because of your account on code.videolan.org.
More information about the vlc-commits
mailing list