aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorFelix Domke <tmbinc@elitedvb.net>2006-01-26 12:56:09 +0000
committerFelix Domke <tmbinc@elitedvb.net>2006-01-26 12:56:09 +0000
commitcceb3c9e6ec5c92240f592e3a435ca25ce1facca (patch)
tree15210d94caaec321cb3fa36ca0114743c2e4ebf7 /lib
parent64a629d1dd12dbe16b6d8a74a2f2dc3425fef138 (diff)
downloadenigma2-cceb3c9e6ec5c92240f592e3a435ca25ce1facca.tar.gz
enigma2-cceb3c9e6ec5c92240f592e3a435ca25ce1facca.zip
(controlled) SEGFAULT on assert, in order to allow debugging with core files
Diffstat (limited to 'lib')
-rw-r--r--lib/base/smartptr.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/base/smartptr.h b/lib/base/smartptr.h
index 814d7457..6c3dbc2f 100644
--- a/lib/base/smartptr.h
+++ b/lib/base/smartptr.h
@@ -5,6 +5,8 @@
#include <stdio.h>
#include <lib/python/swig.h>
+inline void ptrAssert(void *p) { if (!p) *(unsigned long*)0=0; }
+
template<class T>
class ePtr
{
@@ -54,7 +56,7 @@ public:
T* grabRef() { if (!ptr) return 0; ptr->AddRef(); return ptr; }
T* &ptrref() { assert(!ptr); return ptr; }
- T* operator->() const { assert(ptr); return ptr; }
+ T* operator->() const { ptrAssert(ptr); return ptr; }
operator T*() const { return this->ptr; }
operator bool() const { return !!this->ptr; }
@@ -131,7 +133,7 @@ public:
T* grabRef() { if (!ptr) return 0; ptr->AddRef(); ptr->AddUse(); return ptr; }
T* &ptrref() { assert(!ptr); return ptr; }
- T* operator->() const { assert(ptr); return ptr; }
+ T* operator->() const { ptrAssert(ptr); return ptr; }
operator T*() const { return this->ptr; }
};
@@ -179,13 +181,13 @@ public:
}
- ePtrHelper<T> operator->() { assert(ptr); return ePtrHelper<T>(ptr); }
+ ePtrHelper<T> operator->() { ptrAssert(ptr); return ePtrHelper<T>(ptr); }
/* for const objects, we don't need the helper, as they can't */
/* be changed outside the program flow. at least this is */
/* what the compiler assumes, so in case you're using const */
/* eMutablePtrs note that they have to be const. */
- const T* operator->() const { assert(ptr); return ptr; }
+ const T* operator->() const { ptrAssert(ptr); return ptr; }
};
#endif