# HG changeset patch
# User insilmaril
# Date 1216209404 0
# Node ID 462d3950227337b6b6c460280e174afec93189c2
# Parent  12958f987bcf8ed9595994c5354643224757694e
no more segfault when deleting animated part

diff -r 12958f987bcf -r 462d39502273 branchobj.cpp
--- a/branchobj.cpp	Wed Jul 16 10:46:14 2008 +0000
+++ b/branchobj.cpp	Wed Jul 16 11:56:44 2008 +0000
@@ -53,6 +53,13 @@
 
 BranchObj::~BranchObj ()
 {
+	// If I'm animated, I need to un-animate myself first
+	if (anim.isAnimated() )
+	{
+		anim.setAnimated (false);
+		model->stopAnimation (this);
+	}
+
 	//cout << "Destr BranchObj of "<<this<<endl;
 	// Check, if this branch was the last child to be deleted
 	// If so, unset the scrolled flags
diff -r 12958f987bcf -r 462d39502273 tex/vym.changelog
--- a/tex/vym.changelog	Wed Jul 16 10:46:14 2008 +0000
+++ b/tex/vym.changelog	Wed Jul 16 11:56:44 2008 +0000
@@ -1,3 +1,9 @@
+-------------------------------------------------------------------
+Wed Jul 16 13:47:01 CEST 2008 - uwedr@suse.de
+
+- Version: 1.13.0 
+- Bugfix: Deleting an animated part no longer segfaults 
+
 -------------------------------------------------------------------
 Fri Jul 11 14:01:31 CEST 2008 - uwedr@suse.de
 
diff -r 12958f987bcf -r 462d39502273 vymmodel.cpp
--- a/vymmodel.cpp	Wed Jul 16 10:46:14 2008 +0000
+++ b/vymmodel.cpp	Wed Jul 16 11:56:44 2008 +0000
@@ -1421,10 +1421,6 @@
 	return NULL;
 }
 
-void VymModel::removeSelection()
-{
-}
-
 QString VymModel::saveToDir (const QString &tmpdir,const QString &prefix, int verbose, const QPointF &offset)
 {
     QString s;
@@ -2134,6 +2130,11 @@
 	}
 	if (bo && selection.type()==Selection::Branch)
 	{
+		//FIXME need to check if any animObj is part of Branch, remove from animated obj list then
+
+		// missing!!!!
+
+
 		BranchObj* par=(BranchObj*)bo->getParObj();
 		selection.unselect();
 		saveStateRemovingPart (bo, QString ("Delete %1").arg(getObjectName(bo)));
@@ -4063,6 +4064,13 @@
 	}
 }
 
+void VymModel::stopAnimation (MapObj *mo)
+{
+	int i=animObjList.indexOf(mo);
+    if (i>=0)
+		animObjList.removeAt (i);
+}
+
 void VymModel::sendSelection()
 {
 	if (netstate!=Server) return;
diff -r 12958f987bcf -r 462d39502273 vymmodel.h
--- a/vymmodel.h	Wed Jul 16 10:46:14 2008 +0000
+++ b/vymmodel.h	Wed Jul 16 11:56:44 2008 +0000
@@ -223,8 +223,6 @@
     LinkableMapObj* findObjBySelect (const QString &s);		// find MapObj by select string
     LinkableMapObj* findID (const QString &s);				// find MapObj by previously set ID
 
-	void removeSelection ();								// remove selected object
-
 	QString saveToDir (const QString&,const QString&,int, const QPointF&);// Save data recursivly to tempdir
 
 
@@ -464,6 +462,8 @@
 	void animate();						//!< Called by timer to animate stuff
 public:
 	void startAnimation(const QPointF &start, const QPointF &dest);
+	void stopAnimation(MapObj *mo);
+
 ////////////////////////////////////////////
 // Network related 
 ////////////////////////////////////////////