Browse Source

prevent crash in non-threaded case; build niceties

David Rose 19 years ago
parent
commit
a5e9ab5f10

+ 10 - 0
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

+ 3 - 0
panda/src/express/pointerToVoid.h

@@ -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;

+ 0 - 9
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
 }
 

+ 9 - 0
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

+ 1 - 0
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();