kwave  18.07.70
AlsaMallocWrapper< T,, > Class Template Reference
Collaboration diagram for AlsaMallocWrapper< T,, >:
Collaboration graph

Public Member Functions

 AlsaMallocWrapper ()
 
virtual ~AlsaMallocWrapper ()
 
 operator T*& ()
 

Private Attributes

T * m_data
 

Detailed Description

template<class T, int(allocator)(T **), void(deleter)(T *)>
class AlsaMallocWrapper< T,, >

Wrapper for avoiding use of the ALSA alloca based functions which do not work well with -fstack-protector of newer GCC versions, and also avoids potential memory leaks when using pure ALSA malloc/free based functions.

Definition at line 160 of file PlayBack-ALSA.cpp.

Constructor & Destructor Documentation

◆ AlsaMallocWrapper()

template<class T , int(allocator)(T **) , void(deleter)(T *) >
AlsaMallocWrapper< T,, >::AlsaMallocWrapper ( )
inline

constructor, creates an object using the allocator function

Definition at line 164 of file PlayBack-ALSA.cpp.

References AlsaMallocWrapper< T,, >::m_data.

165  :m_data(Q_NULLPTR)
166  {
167  allocator(&m_data);
168  }

◆ ~AlsaMallocWrapper()

template<class T , int(allocator)(T **) , void(deleter)(T *) >
virtual AlsaMallocWrapper< T,, >::~AlsaMallocWrapper ( )
inlinevirtual

destructor, frees the object using the deleter function

Definition at line 171 of file PlayBack-ALSA.cpp.

References AlsaMallocWrapper< T,, >::m_data.

172  {
173  if (m_data) deleter(m_data);
174  m_data = Q_NULLPTR;
175  }

Member Function Documentation

◆ operator T*&()

template<class T , int(allocator)(T **) , void(deleter)(T *) >
AlsaMallocWrapper< T,, >::operator T*& ( )
inline

conversion operator, returns the ALSA object

Definition at line 178 of file PlayBack-ALSA.cpp.

References AlsaMallocWrapper< T,, >::m_data.

178 { return m_data; }

Member Data Documentation

◆ m_data

template<class T , int(allocator)(T **) , void(deleter)(T *) >
T* AlsaMallocWrapper< T,, >::m_data
private

The documentation for this class was generated from the following file: