From 5258ea3fc1fc9e3b45627fd217e5229fc53f305a Mon Sep 17 00:00:00 2001 From: dooglus Date: Sat, 8 Sep 2007 23:03:11 +0000 Subject: [PATCH] Put a mutex around Plant::sync() to stop 2 threads running it at the same time. This was causing crashes. The same probably needs doing to most of the other layers, too. git-svn-id: http://svn.voria.com/code@635 1f10aa63-cdf2-0310-b900-c93c546f37ac --- synfig-core/trunk/src/modules/mod_particle/plant.cpp | 3 +++ synfig-core/trunk/src/modules/mod_particle/plant.h | 1 + 2 files changed, 4 insertions(+) diff --git a/synfig-core/trunk/src/modules/mod_particle/plant.cpp b/synfig-core/trunk/src/modules/mod_particle/plant.cpp index 7c8d5ac..2a93935 100644 --- a/synfig-core/trunk/src/modules/mod_particle/plant.cpp +++ b/synfig-core/trunk/src/modules/mod_particle/plant.cpp @@ -102,6 +102,7 @@ Plant::Plant(): splits=5; drag=0.1; size=0.015; + needs_sync_=true; sync(); size_as_alpha=false; } @@ -174,6 +175,8 @@ Plant::calc_bounding_rect()const void Plant::sync()const { + Mutex::Lock lock(mutex); + if (!needs_sync_) return; particle_list.clear(); bounding_rect=Rect::zero(); diff --git a/synfig-core/trunk/src/modules/mod_particle/plant.h b/synfig-core/trunk/src/modules/mod_particle/plant.h index 54dafe4..4f03541 100644 --- a/synfig-core/trunk/src/modules/mod_particle/plant.h +++ b/synfig-core/trunk/src/modules/mod_particle/plant.h @@ -83,6 +83,7 @@ private: bool size_as_alpha; mutable bool needs_sync_; + mutable synfig::Mutex mutex; void branch(int n, int depth,float t, float stunt_growth, synfig::Point position,synfig::Vector velocity)const; -- 2.7.4