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 | |
| 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')
| -rw-r--r-- | lib/base/eerror.cpp | 3 | ||||
| -rw-r--r-- | lib/base/object.h | 12 | ||||
| -rw-r--r-- | lib/base/smartptr.h | 8 |
3 files changed, 17 insertions, 6 deletions
diff --git a/lib/base/eerror.cpp b/lib/base/eerror.cpp index 0871bb71..ac62f1e9 100644 --- a/lib/base/eerror.cpp +++ b/lib/base/eerror.cpp @@ -20,6 +20,7 @@ void eFatal(const char* fmt, ...) va_end(ap); logOutput(lvlFatal, buf); fprintf(stderr, "%s\n",buf ); +#if 0 if (!infatal) { infatal=1; @@ -27,6 +28,8 @@ void eFatal(const char* fmt, ...) msg.show(); msg.exec(); } +#endif + _exit(0); } 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 diff --git a/lib/base/smartptr.h b/lib/base/smartptr.h index 85ad5a90..aafecf0e 100644 --- a/lib/base/smartptr.h +++ b/lib/base/smartptr.h @@ -43,21 +43,21 @@ public: } ePtr &operator=(T *c) { + if (c) + c->AddRef(); if (ptr) ptr->Release(); ptr=c; - if (ptr) - ptr->AddRef(); return *this; } ePtr &operator=(ePtr<T> &c) { + if (c.ptr) + c.ptr->AddRef(); if (ptr) ptr->Release(); ptr=c.ptr; - if (ptr) - ptr->AddRef(); return *this; } |
