Index: /trunk/SophyaPI/PIext/nobjmgr.cc
===================================================================
--- /trunk/SophyaPI/PIext/nobjmgr.cc	(revision 2489)
+++ /trunk/SophyaPI/PIext/nobjmgr.cc	(revision 2490)
@@ -108,6 +108,7 @@
 
 /* --Methode-- */
-NamedObjMgr::NamedObjMgr()
-{
+NamedObjMgr::NamedObjMgr(bool fgimgapp)
+{
+_fgimgapp = fgimgapp;
 if (fgOInit == 0) { 
   myNObj = 0;
@@ -302,4 +303,5 @@
 if (myImgApp)  { 
   string str = '/' + dirname;
+  if ( !_fgimgapp )  ZSync(myImgApp->getMutex(),2);
   (myImgApp->ObjMgrW())->AddDirectory(str.c_str(), myDirId);
   }
@@ -333,6 +335,8 @@
   }
 
-if (myImgApp)  
+if (myImgApp) {
+  if ( !_fgimgapp )  ZSync(myImgApp->getMutex(),2);
   (myImgApp->ObjMgrW())->DelDirectory((*it).second.id);
+}
 myDirs->erase(it);
 if (verbeux) cout << "NamedObjMgr::DeleteDir() " << dirname << " deleted " << endl;  
@@ -459,6 +463,8 @@
 list<string>::iterator ii;
 for(ii=odel.begin(); ii != odel.end(); ii++)  DelObj(*ii,true);
-if (myImgApp)  
+if (myImgApp) {
+  if ( !_fgimgapp )  ZSync(myImgApp->getMutex(),2);
   (myImgApp->ObjMgrW())->UpdateList(did);
+}
 }
 
@@ -561,8 +567,11 @@
 (*itr).second.nobj++;
 
-if ( (myImgApp != NULL) && (myImgApp->ObjMgrW())->Visible() ) {
-  string oln = nobj + "  (T= " + no.obja->GetDataObjType() + ")" ; 
-  (myImgApp->ObjMgrW())->AddObjList(did, oln.c_str(), no.oid);
-  }
+if (myImgApp != NULL) {
+  if ( !_fgimgapp )  ZSync(myImgApp->getMutex(),2);
+  if ( (myImgApp->ObjMgrW())->Visible() ) {
+    string oln = nobj + "  (T= " + no.obja->GetDataObjType() + ")" ; 
+    (myImgApp->ObjMgrW())->AddObjList(did, oln.c_str(), no.oid);
+  }
+}
 if (verbeux) cout << "NamedObjMgr::AddObj()  Object " << nom << " ( "  
      << typeid(*obj).name() << " ) added (Total= " << myObjs->size() << ")" << endl;  
@@ -632,8 +641,11 @@
 (*itr).second.nobj++;
 
-if ( (myImgApp != NULL) && (myImgApp->ObjMgrW())->Visible() ) {
-  (myImgApp->ObjMgrW())->DelObjList(dids, no.oid);
-  string oln = n2 + "  (T= " + no.obja->GetDataObjType() + ")" ; 
-  (myImgApp->ObjMgrW())->AddObjList(did, oln.c_str(), no.oid);
+if (myImgApp != NULL) {
+  if ( !_fgimgapp )  ZSync(myImgApp->getMutex(),2);
+  if ( (myImgApp->ObjMgrW())->Visible() ) {
+    (myImgApp->ObjMgrW())->DelObjList(dids, no.oid);
+    string oln = n2 + "  (T= " + no.obja->GetDataObjType() + ")" ; 
+    (myImgApp->ObjMgrW())->AddObjList(did, oln.c_str(), no.oid);
+  }
 }
 if (verbeux) 
@@ -681,7 +693,10 @@
 if (fgd) delete (*it).second.obj;
 
-if ( (myImgApp != NULL) && (myImgApp->ObjMgrW())->Visible() ) {
-  int olid = (*it).second.oid;
-  (myImgApp->ObjMgrW())->DelObjList(did, olid);
+if (myImgApp != NULL) {
+  if ( !_fgimgapp )  ZSync(myImgApp->getMutex(),2);
+  if ( (myImgApp->ObjMgrW())->Visible() ) {
+    int olid = (*it).second.oid;
+    (myImgApp->ObjMgrW())->DelObjList(did, olid);
+  }
 }
 myObjs->erase(it);
@@ -1474,4 +1489,6 @@
 {
 if (!myImgApp)  return;
+if ( !_fgimgapp )  ZSync(myImgApp->getMutex(),2);
+
 (myImgApp->ObjMgrW())->ClearObjList();
 
Index: /trunk/SophyaPI/PIext/nobjmgr.h
===================================================================
--- /trunk/SophyaPI/PIext/nobjmgr.h	(revision 2489)
+++ /trunk/SophyaPI/PIext/nobjmgr.h	(revision 2490)
@@ -26,5 +26,5 @@
 public:
 // Constructeur et destructeur
-			NamedObjMgr();
+			NamedObjMgr(bool fgimgapp=false);
   virtual		~NamedObjMgr();
 
@@ -107,4 +107,7 @@
   static bool CheckDirName(string & nom);
   static int  ParseObjectName(string & nom, string & nomrep, string & nomobj);
+
+protected:
+  bool _fgimgapp;  // true -> cree par PIStdImgApp / pour gestion de thread
 };
 
Index: /trunk/SophyaPI/PIext/piacmd.cc
===================================================================
--- /trunk/SophyaPI/PIext/piacmd.cc	(revision 2489)
+++ /trunk/SophyaPI/PIext/piacmd.cc	(revision 2490)
@@ -146,8 +146,8 @@
 // static PIACmd* curpiacmd = NULL;
 /* --Methode-- */
-PIACmd::PIACmd(NamedObjMgr* omg, PIStdImgApp* app)
+PIACmd::PIACmd(PIStdImgApp* app)
   : Commander()
 {
-mObjMgr = omg; 
+mObjMgr = new NamedObjMgr; 
 mImgApp = app;
 helpwin = new PIAHelpWind(app, this);
@@ -165,5 +165,5 @@
 RegisterCommand(kw, usage, NULL, grp);
 
-basexec = new PIABaseExecutor(this, omg, app);
+basexec = new PIABaseExecutor(this, mObjMgr, app);
 fitexec = new PIAFitter(this, app);
 pawexec = new PAWExecutor(this, app);
@@ -188,5 +188,5 @@
 PIACmd::~PIACmd()
 {
- 
+delete mObjMgr;
 delete helpwin;
 delete cxxexwin;
Index: /trunk/SophyaPI/PIext/piacmd.h
===================================================================
--- /trunk/SophyaPI/PIext/piacmd.h	(revision 2489)
+++ /trunk/SophyaPI/PIext/piacmd.h	(revision 2490)
@@ -35,5 +35,5 @@
   //  static PIACmd*	GetInterpreter();
 
-			PIACmd(NamedObjMgr* omg, PIStdImgApp* app);
+			PIACmd(PIStdImgApp* app);
   virtual		~PIACmd();
 
Index: /trunk/SophyaPI/PIext/pistdimgapp.cc
===================================================================
--- /trunk/SophyaPI/PIext/pistdimgapp.cc	(revision 2489)
+++ /trunk/SophyaPI/PIext/pistdimgapp.cc	(revision 2490)
@@ -251,6 +251,6 @@
 // RedirectStdOutErr(true);  pas par defaut 
  
-mObjMgr = new NamedObjMgr;
-mCmd = new PIACmd(mObjMgr, this);
+mObjMgr = new NamedObjMgr(true);
+mCmd = new PIACmd(this);
 
 // Pas trop de message de la part de NamedObjMgr
@@ -322,4 +322,5 @@
 
 SetReady();
+fg_glsynlock = false;
 }
 
@@ -418,11 +419,13 @@
 }
 
-bool fg_gls_lock = false;
+
 while (mStop) {
   thr_glsyn.lock(); //  <ZThread> 
+  fg_glsynlock = true;
   while (XtAppPending(*appctx) != 0) {
     XtAppNextEvent(*appctx, &evt);
     XtDispatchEvent(&evt);
   }
+  fg_glsynlock = false;
   thr_glsyn.unlock(); //  <ZThread> 
   //  thr_glsyn.wait();
Index: /trunk/SophyaPI/PIext/pistdimgapp.h
===================================================================
--- /trunk/SophyaPI/PIext/pistdimgapp.h	(revision 2489)
+++ /trunk/SophyaPI/PIext/pistdimgapp.h	(revision 2490)
@@ -58,4 +58,5 @@
      virtual void   Run();
      inline ZMutex &   getMutex() { return thr_glsyn; }
+     inline bool       isGlSyncLocked() { return fg_glsynlock; }
 
   // Methodes d'Affichage generique
@@ -234,4 +235,5 @@
   // Attributs pour controle de thread
     ZMutex thr_glsyn;
+    bool fg_glsynlock;  // true: thr_glsyn locke pour traitement evts
 };
 
