prevent crash in non-threaded case; build niceties

This commit is contained in:
David Rose 2006-04-12 22:53:20 +00:00
parent 27bc202f98
commit a5e9ab5f10
5 changed files with 23 additions and 9 deletions

View File

@ -37,6 +37,16 @@ INLINE PointerToVoid::
nassertv(_void_ptr == (void *)NULL);
}
////////////////////////////////////////////////////////////////////
// Function: PointerToVoid::Copy Constructor
// Access: Private
// Description: Don't use this constructor.
////////////////////////////////////////////////////////////////////
INLINE PointerToVoid::
PointerToVoid(const PointerToVoid &) {
nassertv(false);
}
////////////////////////////////////////////////////////////////////
// Function: PointerToVoid::is_null
// Access: Published

View File

@ -38,6 +38,9 @@ protected:
INLINE PointerToVoid();
INLINE ~PointerToVoid();
private:
INLINE PointerToVoid(const PointerToVoid &copy);
PUBLISHED:
INLINE bool is_null() const;
INLINE size_t get_hash() const;

View File

@ -58,7 +58,6 @@ do_test_ref_count_integrity() const {
////////////////////////////////////////////////////////////////////
void ReferenceCount::
create_weak_list() {
#ifdef HAVE_ATOMIC_COMPARE_AND_EXCHANGE_PTR
WeakReferenceList *weak_list = new WeakReferenceList;
void *orig =
AtomicAdjust::compare_and_exchange_ptr((void *&)_weak_list, NULL, weak_list);
@ -66,13 +65,5 @@ create_weak_list() {
// Someone else created it first.
delete weak_list;
}
#else
static MutexImpl lock;
lock.lock();
if (_weak_list != (WeakReferenceList *)NULL) {
_weak_list = new WeakReferenceList;
}
lock.release();
#endif // HAVE_ATOMIC_COMPARE_AND_EXCHANGE_PTR
}

View File

@ -27,6 +27,15 @@ WeakPointerToVoid() {
_ptr_was_deleted = false;
}
////////////////////////////////////////////////////////////////////
// Function: WeakPointerToVoid::Destructor
// Access: Protected
// Description:
////////////////////////////////////////////////////////////////////
INLINE WeakPointerToVoid::
~WeakPointerToVoid() {
}
////////////////////////////////////////////////////////////////////
// Function: WeakPointerToVoid::mark_deleted
// Access: Public

View File

@ -31,6 +31,7 @@
class EXPCL_PANDAEXPRESS WeakPointerToVoid : public PointerToVoid {
protected:
INLINE WeakPointerToVoid();
INLINE ~WeakPointerToVoid();
public:
INLINE void mark_deleted();