[vlc-commits] demux: adaptive: add inheritable wrapper deleter

Francois Cartegnie git at videolan.org
Wed Apr 7 18:29:00 UTC 2021


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sun Jan 10 17:05:02 2021 +0100| [7744c8b69d3d32de6dda061c62c7eab7b77db6b9] | committer: Francois Cartegnie

demux: adaptive: add inheritable wrapper deleter

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7744c8b69d3d32de6dda061c62c7eab7b77db6b9
---

 modules/demux/adaptive/playlist/Inheritables.hpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/modules/demux/adaptive/playlist/Inheritables.hpp b/modules/demux/adaptive/playlist/Inheritables.hpp
index 70d9c56992..51ac6731d9 100644
--- a/modules/demux/adaptive/playlist/Inheritables.hpp
+++ b/modules/demux/adaptive/playlist/Inheritables.hpp
@@ -105,12 +105,14 @@ namespace adaptive
         {
             public:
                 AttrWrapper(T v) : AbstractAttr(e) { value = v; }
-                virtual ~AttrWrapper() {}
+                virtual ~AttrWrapper() { condDeleteValue(value); }
                 AttrWrapper(const AttrWrapper &) = delete;
                 AttrWrapper<e, T> & operator=(const AttrWrapper<e, T> &) = delete;
                 operator const T&() const { return value; }
 
             protected:
+                void condDeleteValue(const T &) {}
+                void condDeleteValue(T* &v) { delete v; }
                 T value;
         };
 



More information about the vlc-commits mailing list