From d45b61f0411928dfc5523d4436fe30c0ec09acd4 Mon Sep 17 00:00:00 2001
From: codeimp <codeimp@e0d998f2-2e9b-42fe-843d-47128df60a06>
Date: Fri, 19 Jun 2009 07:59:38 +0000
Subject: [PATCH] Fixed a bug that sometimes caused a crash on undo

---
 Source/Core/Map/Vertex.cs | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/Source/Core/Map/Vertex.cs b/Source/Core/Map/Vertex.cs
index 0e2242874..33f082d8c 100644
--- a/Source/Core/Map/Vertex.cs
+++ b/Source/Core/Map/Vertex.cs
@@ -97,12 +97,6 @@ namespace CodeImp.DoomBuilder.Map
 				// Already set isdisposed so that changes can be prohibited
 				isdisposed = true;
 
-				if(map == General.Map.Map)
-					General.Map.UndoRedo.RecRemVertex(this);
-				
-				// Remove from main list
-				map.RemoveVertex(listindex);
-
 				if(map.AutoRemove)
 				{
 					// Dispose the lines that are attached to this vertex
@@ -115,6 +109,12 @@ namespace CodeImp.DoomBuilder.Map
 					foreach(Linedef ld in linedefs) ld.DetachVertexP(this);
 				}
 				
+				if(map == General.Map.Map)
+					General.Map.UndoRedo.RecRemVertex(this);
+				
+				// Remove from main list
+				map.RemoveVertex(listindex);
+
 				// Clean up
 				linedefs = null;
 				map = null;
-- 
GitLab