From ab96672a2eaf31911e63834897303b614b10a22b Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Thu, 15 Oct 2009 21:03:43 +0000
Subject: [PATCH] fix crash when deleting views in some cases when we have
 aliases of aliases (old bug)

---
 Post/PView.cpp | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/Post/PView.cpp b/Post/PView.cpp
index 41c5dea242..8c6a65a5a5 100644
--- a/Post/PView.cpp
+++ b/Post/PView.cpp
@@ -58,7 +58,15 @@ PView::PView(PViewData *data, int num)
 PView::PView(PView *ref, bool copyOptions)
 {
   _init();
-  _aliasOf = ref->getNum();
+
+  if(ref->getAliasOf()){ // alias of an alias
+    PView *orig = getViewByNum(ref->getAliasOf());
+    if(orig) _aliasOf = orig->getNum();
+    else Msg::Error("Could not find original view for alias");
+  }
+  else
+    _aliasOf = ref->getNum();
+
   _data = ref->getData();
   if(copyOptions)
     _options = new PViewOptions(*ref->getOptions());
-- 
GitLab