nodeReferenceCount.cxx 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Filename: nodeReferenceCount.cxx
  2. // Created by: drose (01May06)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
  8. //
  9. // All use of this software is subject to the terms of the Panda 3d
  10. // Software license. You should have received a copy of this license
  11. // along with this source code; you will also find a current copy of
  12. // the license at http://etc.cmu.edu/panda3d/docs/license/ .
  13. //
  14. // To contact the maintainers of this program write to
  15. // [email protected] .
  16. //
  17. ////////////////////////////////////////////////////////////////////
  18. #include "nodeReferenceCount.h"
  19. TypeHandle NodeReferenceCount::_type_handle;
  20. ////////////////////////////////////////////////////////////////////
  21. // Function: NodeReferenceCount::do_test_ref_count_integrity
  22. // Access: Protected
  23. // Description: Does some easy checks to make sure that the reference
  24. // count isn't completely bogus.
  25. ////////////////////////////////////////////////////////////////////
  26. bool NodeReferenceCount::
  27. do_test_ref_count_integrity() const {
  28. nassertr(this != NULL, false);
  29. // If this assertion fails, we're trying to delete an object that
  30. // was just deleted. Possibly you used a real pointer instead of a
  31. // PointerTo at some point, and the object was deleted when the
  32. // PointerTo went out of scope. Maybe you tried to create an
  33. // automatic (local variable) instance of a class that derives from
  34. // ReferenceCount. Or maybe your headers are out of sync, and you
  35. // need to make clean in direct or some higher tree.
  36. nassertr(_node_ref_count != -100, false);
  37. // If this assertion fails, the reference counts are all screwed
  38. // up altogether. Maybe some errant code stomped all over memory
  39. // somewhere.
  40. nassertr(_node_ref_count >= 0, false);
  41. return ReferenceCount::do_test_ref_count_integrity();
  42. }