diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2004-06-02 01:11:59 +0000 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2004-06-02 01:11:59 +0000 |
| commit | 3bad22d5566624804a73b3791980bab2d84c8266 (patch) | |
| tree | eb99b584b542cdc2ab264d8439ba771a117f0cb2 /lib/base/object.h | |
| parent | d6f6602d7cea3a7899990fe79216af7d98d05917 (diff) | |
| download | enigma2-3bad22d5566624804a73b3791980bab2d84c8266.tar.gz enigma2-3bad22d5566624804a73b3791980bab2d84c8266.zip | |
- disabled gui for a moment
- beginning of GDI2 work (region/fill/line works)
- fixed smartptr self assignment
- finally replaced "int ref" by something with a constructor
Diffstat (limited to 'lib/base/object.h')
| -rw-r--r-- | lib/base/object.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/base/object.h b/lib/base/object.h index 744bff19..ddb4512c 100644 --- a/lib/base/object.h +++ b/lib/base/object.h @@ -19,10 +19,18 @@ public: virtual void Release()=0; }; -#define DECLARE_REF private: int ref; public: void AddRef(); void Release(); +class oRefCount +{ + int ref; +public: + oRefCount(): ref(0) { } + operator int&() { return ref; } +}; + +#define DECLARE_REF private: oRefCount ref; public: void AddRef(); void Release(); #ifdef OBJECT_DEBUG extern int object_total_remaining; -#define DEFINE_REF(c) void c::AddRef() { ++object_total_remaining; ++ref; eDebug("OBJECT_DEBUG " #c "+%p now %d", this, ref); } void c::Release() { --object_total_remaining; eDebug("OBJECT_DEBUG " #c "-%p now %d", this, ref-1); if (!--ref) delete this; } +#define DEFINE_REF(c) void c::AddRef() { ++object_total_remaining; ++ref; eDebug("OBJECT_DEBUG " #c "+%p now %d", this, (int)ref); } void c::Release() { --object_total_remaining; eDebug("OBJECT_DEBUG " #c "-%p now %d", this, ref-1); if (!--ref) delete this; } #else #define DEFINE_REF(c) void c::AddRef() { ++ref; } void c::Release() { if (!--ref) delete this; } #endif |
