From a5e9ab5f10cbe7feb4d5b5fab1b647540b735538 Mon Sep 17 00:00:00 2001 From: David Rose Date: Wed, 12 Apr 2006 22:53:20 +0000 Subject: [PATCH] prevent crash in non-threaded case; build niceties --- panda/src/express/pointerToVoid.I | 10 ++++++++++ panda/src/express/pointerToVoid.h | 3 +++ panda/src/express/referenceCount.cxx | 9 --------- panda/src/express/weakPointerToVoid.I | 9 +++++++++ panda/src/express/weakPointerToVoid.h | 1 + 5 files changed, 23 insertions(+), 9 deletions(-) diff --git a/panda/src/express/pointerToVoid.I b/panda/src/express/pointerToVoid.I index 9ec2fb0663..93a863531d 100644 --- a/panda/src/express/pointerToVoid.I +++ b/panda/src/express/pointerToVoid.I @@ -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 diff --git a/panda/src/express/pointerToVoid.h b/panda/src/express/pointerToVoid.h index 51f043aa3a..d6ff0ee2c4 100644 --- a/panda/src/express/pointerToVoid.h +++ b/panda/src/express/pointerToVoid.h @@ -38,6 +38,9 @@ protected: INLINE PointerToVoid(); INLINE ~PointerToVoid(); +private: + INLINE PointerToVoid(const PointerToVoid ©); + PUBLISHED: INLINE bool is_null() const; INLINE size_t get_hash() const; diff --git a/panda/src/express/referenceCount.cxx b/panda/src/express/referenceCount.cxx index faeaf18538..3c0d8370c6 100644 --- a/panda/src/express/referenceCount.cxx +++ b/panda/src/express/referenceCount.cxx @@ -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 } diff --git a/panda/src/express/weakPointerToVoid.I b/panda/src/express/weakPointerToVoid.I index 410e1598c7..6325843de7 100644 --- a/panda/src/express/weakPointerToVoid.I +++ b/panda/src/express/weakPointerToVoid.I @@ -27,6 +27,15 @@ WeakPointerToVoid() { _ptr_was_deleted = false; } +//////////////////////////////////////////////////////////////////// +// Function: WeakPointerToVoid::Destructor +// Access: Protected +// Description: +//////////////////////////////////////////////////////////////////// +INLINE WeakPointerToVoid:: +~WeakPointerToVoid() { +} + //////////////////////////////////////////////////////////////////// // Function: WeakPointerToVoid::mark_deleted // Access: Public diff --git a/panda/src/express/weakPointerToVoid.h b/panda/src/express/weakPointerToVoid.h index 734e295b00..c0691dd425 100644 --- a/panda/src/express/weakPointerToVoid.h +++ b/panda/src/express/weakPointerToVoid.h @@ -31,6 +31,7 @@ class EXPCL_PANDAEXPRESS WeakPointerToVoid : public PointerToVoid { protected: INLINE WeakPointerToVoid(); + INLINE ~WeakPointerToVoid(); public: INLINE void mark_deleted();