Put a mutex around Plant::sync() to stop 2 threads running it at the same time. ...
authordooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Sat, 8 Sep 2007 23:03:11 +0000 (23:03 +0000)
committerdooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Sat, 8 Sep 2007 23:03:11 +0000 (23:03 +0000)
git-svn-id: http://svn.voria.com/code@635 1f10aa63-cdf2-0310-b900-c93c546f37ac

synfig-core/trunk/src/modules/mod_particle/plant.cpp
synfig-core/trunk/src/modules/mod_particle/plant.h

index 7c8d5ac..2a93935 100644 (file)
@@ -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();
index 54dafe4..4f03541 100644 (file)
@@ -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;