Permalink
Browse files

Refs #10311. Use reference counting for MythRenderVDPAU.

Stuart Morgan noticed an error message on Friday that pointed to
non-use of the reference counter in a reference counted class.
This makes the respective classes use reference counting and
makes the MythRenderVDPAU destructor private so any such use will
be caught at compile time in the future.
  • Loading branch information...
1 parent 2eabe31 commit 7e98bdb1b9f05dd42ac6076557afe696ded79666 @daniel-kristjansson daniel-kristjansson committed Jun 4, 2012
View
2 mythtv/libs/libmythtv/videoout_nullvdpau.cpp
@@ -83,7 +83,7 @@ void VideoOutputNullVDPAU::DeleteRender(void)
{
if (m_decoder)
m_render->DestroyDecoder(m_decoder);
- delete m_render;
+ m_render->DecrRef();
}
m_decoder = 0;
View
3 mythtv/libs/libmythtv/videoout_vdpau.cpp
@@ -161,7 +161,8 @@ void VideoOutputVDPAU::DeleteRender(void)
if (m_decoder)
m_render->DestroyDecoder(m_decoder);
- delete m_render;
+ m_render->DecrRef();
+ m_render = NULL;
}
m_checked_output_surfaces = false;
View
9 mythtv/libs/libmythui/mythpainter_vdpau.cpp
@@ -19,11 +19,11 @@
#define LOC QString("VDPAU Painter: ")
MythVDPAUPainter::MythVDPAUPainter(MythRenderVDPAU *render) :
- MythPainter(), m_render(render), m_created_render(true), m_target(0),
+ MythPainter(), m_render(render), m_target(0),
m_swap_control(true)
{
if (m_render)
- m_created_render = false;
+ m_render->IncrRef();
}
MythVDPAUPainter::~MythVDPAUPainter()
@@ -44,7 +44,6 @@ bool MythVDPAUPainter::InitVDPAU(QPaintDevice *parent)
if (!m_render)
return false;
- m_created_render = true;
if (m_render->Create(real_parent->size(), real_parent->winId()))
return true;
@@ -63,9 +62,7 @@ void MythVDPAUPainter::Teardown(void)
if (m_render)
{
- if (m_created_render)
- delete m_render;
- m_created_render = true;
+ m_render->DecrRef();
m_render = NULL;
}
}
View
1 mythtv/libs/libmythui/mythpainter_vdpau.h
@@ -41,7 +41,6 @@ class MUI_PUBLIC MythVDPAUPainter : public MythPainter
uint GetTextureFromCache(MythImage *im);
MythRenderVDPAU *m_render;
- bool m_created_render;
uint m_target;
bool m_swap_control;
View
2 mythtv/libs/libmythui/mythrender_vdpau.h
@@ -66,7 +66,6 @@ class MUI_PUBLIC MythRenderVDPAU : public MythRender
bool CreateDummy(void);
MythRenderVDPAU();
- ~MythRenderVDPAU();
uint GetColorKey(void) { return m_colorKey; }
void SetPreempted(void) { m_preempted = true; }
@@ -138,6 +137,7 @@ class MUI_PUBLIC MythRenderVDPAU : public MythRender
void Decode(uint id, struct vdpau_render_state *render);
private:
+ virtual ~MythRenderVDPAU();
bool CreateDevice(void);
bool GetProcs(void);
bool CreatePresentationQueue(void);

0 comments on commit 7e98bdb

Please sign in to comment.