mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 19:37:02 +00:00
+ Got rid of zip lib requirement in G3D...
Still can re-enable code by defining _HAVE_ZIP...
+ Remove silly X11 lib dependency from G3D
Code doesn't seem to do anything yet anyway, and even if, we don't want it :p
+ Fix another weird G3D build problem...
+ Remove some __asm usage in g3d, which is not available on Win64
My editor also decided to remove a ton of trailing white spaces...tss...
+ Reapply G3D fixes for 64bit VC
+ not use SSE specific header when SSE not enabled in *nix
+ Updated project files
+ New vmap_assembler VC90/VC80 Project
+ vmap assembler binaries updates
NOTE: Old vmap fikes expected work (as tests show) with new library version.
But better use new generated versions. Its different in small parts to bad or good...
(based on Lynx3d's repo commit 44798d3)
Signed-off-by: VladimirMangos <vladimir@getmangos.com>
61 lines
1.8 KiB
C++
61 lines
1.8 KiB
C++
/**
|
|
@file ReferenceCount.cpp
|
|
|
|
Reference Counting Garbage Collector for C++
|
|
|
|
@maintainer Morgan McGuire, http://graphics.cs.williams.edu
|
|
@cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine.
|
|
@cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm
|
|
|
|
@created 2001-10-23
|
|
@edited 2009-04-25
|
|
*/
|
|
#include "G3D/platform.h"
|
|
#include "G3D/ReferenceCount.h"
|
|
|
|
namespace G3D {
|
|
|
|
ReferenceCountedObject::ReferenceCountedObject() :
|
|
ReferenceCountedObject_refCount(0),
|
|
ReferenceCountedObject_weakPointer(0) {
|
|
|
|
debugAssertM(isValidHeapPointer(this),
|
|
"Reference counted objects must be allocated on the heap.");
|
|
}
|
|
|
|
void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() {
|
|
// Tell all of my weak pointers that I'm gone.
|
|
|
|
_WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer;
|
|
|
|
while (node != NULL) {
|
|
// Notify the weak pointer that it is going away
|
|
node->weakPtr->objectCollected();
|
|
|
|
// Free the node and advance
|
|
_WeakPtrLinkedList* tmp = node;
|
|
node = node->next;
|
|
delete tmp;
|
|
}
|
|
}
|
|
|
|
ReferenceCountedObject::~ReferenceCountedObject() {}
|
|
|
|
|
|
ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) :
|
|
ReferenceCountedObject_refCount(0),
|
|
ReferenceCountedObject_weakPointer(0) {
|
|
(void)notUsed;
|
|
debugAssertM(G3D::isValidHeapPointer(this),
|
|
"Reference counted objects must be allocated on the heap.");
|
|
}
|
|
|
|
ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) {
|
|
(void)other;
|
|
// Nothing changes when I am assigned; the reference count on
|
|
// both objects is the same (although my super-class probably
|
|
// changes).
|
|
return *this;
|
|
}
|
|
|
|
} // G3D
|