Browse Source

save self pointer during stash

David Rose 22 years ago
parent
commit
0c7e048d28
1 changed files with 7 additions and 0 deletions
  1. 7 0
      panda/src/pgraph/pandaNode.cxx

+ 7 - 0
panda/src/pgraph/pandaNode.cxx

@@ -1024,6 +1024,13 @@ replace_child(PandaNode *orig_child, PandaNode *new_child) {
 void PandaNode::
 void PandaNode::
 stash_child(int child_index) {
 stash_child(int child_index) {
   nassertv(child_index >= 0 && child_index < get_num_children());
   nassertv(child_index >= 0 && child_index < get_num_children());
+
+  // Save a reference count for ourselves.  I don't think this should
+  // be necessary, but there are occasional crashes in stash() during
+  // furniture moving mode.  Perhaps this will eliminate those
+  // crashes.
+  PT(PandaNode) self = this;
+
   PT(PandaNode) child_node = get_child(child_index);
   PT(PandaNode) child_node = get_child(child_index);
   int sort = get_child_sort(child_index);
   int sort = get_child_sort(child_index);