From c1e2186b6a3b14e4da3232c2c9d2a03c1fb9a1a2 Mon Sep 17 00:00:00 2001 From: Christian Gmeiner Date: Thu, 4 Feb 2010 23:44:01 +0100 Subject: fix crash at shutdown We can not inherit from Singleton as the vdr core does free the created instance. So if we use the auto_ptr based Singleton template class we get a double free. --- dxr3device.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'dxr3device.h') diff --git a/dxr3device.h b/dxr3device.h index 02cfae0..f6eefdb 100644 --- a/dxr3device.h +++ b/dxr3device.h @@ -30,7 +30,7 @@ #include "dxr3audiodecoder.h" #include "dxr3spudecoder.h" #include "dxr3audio.h" -#include "singleton.h" +#include "uncopyable.h" class cDxr3Name { public: @@ -47,10 +47,9 @@ private: cDxr3Device is the interface for VDR devices. Is is the part, which VDR "talks" with our plugin. */ -class cDxr3Device : public cDevice, public Singleton { +class cDxr3Device : public cDevice, public Uncopyable { public: - cDxr3Device(); - ~cDxr3Device(); + static cDxr3Device *instance(); static int Dxr3Open(const char *name, int mode, bool report_error = true); virtual void MakePrimaryDevice(bool On); @@ -97,6 +96,8 @@ public: int ossSetPlayMode(uint32_t mode); private: + cDxr3Device(); + ~cDxr3Device(); void claimDevices(); void releaseDevices(); @@ -122,6 +123,8 @@ private: uint32_t horizontal; uint32_t vertical; + + static cDxr3Device *inst; }; #endif /*_DXR3_DEVICE_H_*/ -- cgit v1.2.3