prevent crash in non-threaded case; build niceties
This commit is contained in:
parent
27bc202f98
commit
a5e9ab5f10
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,15 @@ WeakPointerToVoid() {
|
|||
_ptr_was_deleted = false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: WeakPointerToVoid::Destructor
|
||||
// Access: Protected
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE WeakPointerToVoid::
|
||||
~WeakPointerToVoid() {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: WeakPointerToVoid::mark_deleted
|
||||
// Access: Public
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
class EXPCL_PANDAEXPRESS WeakPointerToVoid : public PointerToVoid {
|
||||
protected:
|
||||
INLINE WeakPointerToVoid();
|
||||
INLINE ~WeakPointerToVoid();
|
||||
|
||||
public:
|
||||
INLINE void mark_deleted();
|
||||
|
|
|
|||
Loading…
Reference in New Issue