Revision: 8581
          http://playerstage.svn.sourceforge.net/playerstage/?rev=8581&view=rev
Author:   hsujohnhsu
Date:     2010-03-11 23:08:56 +0000 (Thu, 11 Mar 2010)

Log Message:
-----------
fix potential for race condition, where factory iface pushes newModel into 
factoryIface->data->newModel before Factory::Init() is call to clear out 
newModel

Modified Paths:
--------------
    code/gazebo/trunk/server/Factory.cc

Modified: code/gazebo/trunk/server/Factory.cc
===================================================================
--- code/gazebo/trunk/server/Factory.cc 2010-03-11 05:31:28 UTC (rev 8580)
+++ code/gazebo/trunk/server/Factory.cc 2010-03-11 23:08:56 UTC (rev 8581)
@@ -51,6 +51,9 @@
   try
   {
     this->factoryIface->Create(World::Instance()->GetGzServer(), "default");
+    this->factoryIface->Lock(1); // lock it right away to clear up data
+    strcpy((char*)this->factoryIface->data->newModel,"");
+    this->factoryIface->Unlock();
   }
   catch (std::string e)
   {
@@ -76,8 +79,6 @@
 // Initialize the controller
 void Factory::Init()
 {
-  // initialize newModel to blank
-  strcpy((char*)this->factoryIface->data->newModel,"");
 }
 
 
////////////////////////////////////////////////////////////////////////////////


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to