From add078423f4502461da7002902f2f1ae34ceb470 Mon Sep 17 00:00:00 2001
From: Shon Ferguson <shonferg@users.sourceforge.net>
Date: Sun, 30 Apr 2006 05:23:05 +0000
Subject: [PATCH] Changed Invalidate to LostRef and changed it to do the test
 within.

---
 NIF_Blocks.cpp | 10 +++++++---
 NIF_Blocks.h   |  2 +-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/NIF_Blocks.cpp b/NIF_Blocks.cpp
index 13344c70..0c2978bb 100644
--- a/NIF_Blocks.cpp
+++ b/NIF_Blocks.cpp
@@ -555,10 +555,14 @@ void CrossRef::SetCrossRef( IBlock * new_ref ) {
 	}
 }
 
-void CrossRef::Invalidate() {
+void CrossRef::LostRef(  IBlock * match ) {
 	//This function's purpouse is to inform this CrossRef that the block it is referencing has died
-	//Simply set it to NULL
-	ref = NULL;
+	//It will be called on every CrossRef in this block, we must check to see if this is the one that
+	//the message is meant for
+	if ( ref == match ) {
+		//Simply set it to NULL  do not call KillRef because the reference is already dead
+		ref = NULL;
+	}
 }
 
 void CrossRef::Fix( const vector<blk_ref> & blocks ) {
diff --git a/NIF_Blocks.h b/NIF_Blocks.h
index 54d83ece..d0cb5c3a 100644
--- a/NIF_Blocks.h
+++ b/NIF_Blocks.h
@@ -162,7 +162,7 @@ public:
 	void SetIndex( const int new_index );
 	IBlock * GetCrossRef() const { return ref; }
 	void SetCrossRef( IBlock * new_ref );
-	void Invalidate();
+	void LostRef( IBlock * match );
 	void Fix( const vector<blk_ref> & blocks );
 private:
 	IBlock * _owner;
-- 
GitLab