[yade] 01/02: Apply upstream fix: segfault on removing clumps.

Anton Gladky gladk at moszumanska.debian.org
Tue Aug 12 19:42:07 UTC 2014


This is an automated email from the git hooks/post-receive script.

gladk pushed a commit to branch master
in repository yade.

commit ca274c21d6395c5a5530d829dfc9579b837d63e0
Author: Anton Gladky <gladk at debian.org>
Date:   Mon Aug 11 22:22:17 2014 +0200

    Apply upstream fix: segfault on removing clumps.
---
 debian/patches/03_fix_segfault_clumps.patch | 60 +++++++++++++++++++++++++++++
 debian/patches/series                       |  1 +
 2 files changed, 61 insertions(+)

diff --git a/debian/patches/03_fix_segfault_clumps.patch b/debian/patches/03_fix_segfault_clumps.patch
new file mode 100644
index 0000000..2f395fa
--- /dev/null
+++ b/debian/patches/03_fix_segfault_clumps.patch
@@ -0,0 +1,60 @@
+From 90640cc8af36602cc0a4b980bc06486c19277adf Mon Sep 17 00:00:00 2001
+From: Anton Gladky <gladky.anton at gmail.com>
+Date: Mon, 11 Aug 2014 20:25:01 +0200
+Subject: [PATCH] Fix crash after clumps removing. Closes LP:1354433
+
+After Clump::del(clumpBody, b), b->clumpId is aways "-1",
+so it is wrong to use it later in this->erase(b->clumpId,false).
+---
+ core/BodyContainer.cpp | 18 ++++++++----------
+ 1 file changed, 8 insertions(+), 10 deletions(-)
+
+diff --git a/core/BodyContainer.cpp b/core/BodyContainer.cpp
+index 7c186da..31d78ad 100644
+--- a/core/BodyContainer.cpp
++++ b/core/BodyContainer.cpp
+@@ -29,15 +29,12 @@ Body::id_t BodyContainer::insert(shared_ptr<Body>& b){
+ 
+ bool BodyContainer::erase(Body::id_t id, bool eraseClumpMembers){//default is false (as before)
+ 	if(!body[id]) return false;
+-	
+ 	const shared_ptr<Body>& b=Body::byId(id);
+-	
+ 	if ((b) and (b->isClumpMember())) {
+-		const shared_ptr<Body>& clumpBody=Body::byId(b->clumpId);
++		const shared_ptr<Body> clumpBody=Body::byId(b->clumpId);
+ 		const shared_ptr<Clump> clump=YADE_PTR_CAST<Clump>(clumpBody->shape);
+ 		Clump::del(clumpBody, b);
+-		
+-		if (clump->members.size()==0) this->erase(b->clumpId,false);	//Clump has no members any more. Remove it
++		if (clump->members.size()==0) this->erase(clumpBody->id,false);	//Clump has no members any more. Remove it
+ 	}
+ 	
+ 	if ((b) and (b->isClump())){
+@@ -46,17 +43,18 @@ bool BodyContainer::erase(Body::id_t id, bool eraseClumpMembers){//default is fa
+ 		std::map<Body::id_t,Se3r>& members = clump->members;
+ 		FOREACH(MemberMap::value_type& mm, members){
+ 			const Body::id_t& memberId=mm.first;
+-			if (eraseClumpMembers) this->erase(memberId,false);	// erase members
+-			//when the last members is erased, the clump will be erased automatically, see above
+-			else Body::byId(memberId)->clumpId=Body::id_t(-1);	// make members standalones
++			if (eraseClumpMembers) {
++				this->erase(memberId,false);	// erase members
++			} else {
++				//when the last members is erased, the clump will be erased automatically, see above
++				Body::byId(memberId)->clumpId=Body::ID_NONE; // make members standalones
++			}
+ 		}
+ 	}
+ 	const shared_ptr<Scene>& scene=Omega::instance().getScene();
+ 	for(Body::MapId2IntrT::iterator it=b->intrs.begin(),end=b->intrs.end(); it!=end; ++it) {  //Iterate over all body's interactions
+ 		scene->interactions->requestErase((*it).second);
+ 	}
+-	
+ 	body[id].reset();
+-	
+ 	return true;
+ }
+-- 
+2.0.3
+
diff --git a/debian/patches/series b/debian/patches/series
index b9e50b7..2892aa3 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 01_remove_google_analytics.patch
 02_fix_DEM-PFV.patch
+03_fix_segfault_clumps.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/yade.git



More information about the debian-science-commits mailing list