Salome HOME
PAL8065
authorsan <san@opencascade.com>
Mon, 28 Feb 2005 15:10:50 +0000 (15:10 +0000)
committersan <san@opencascade.com>
Mon, 28 Feb 2005 15:10:50 +0000 (15:10 +0000)
src/SUPERVGUI/SUPERVGUI_Main.cxx

index 33e2a18d3523673749bc6813774d8b599052e14b..d6e4701a5b86d8334ad3a23576d893fad640cefb 100644 (file)
@@ -58,6 +58,23 @@ using namespace std;
 #include <qlineedit.h>
 #include <qcombobox.h>
 
+// PAL8065: san -- Safe access to widgets from secondary thread
+typedef TVoidMemFunEvent<SUPERVGUI_CanvasArray> TCanvasArrayEvent;
+typedef TVoidMemFunEvent<SUPERVGUI_Canvas> TCanvasEvent;
+
+class UpdateEvent : public SALOME_Event
+{
+ public:
+  UpdateEvent( QAD_Study* study, bool updSel = true ) : myStudy( study ), myUpdateSel( updSel ) {}
+  virtual void Execute(){
+    if ( myStudy ) myStudy->updateObjBrowser( myUpdateSel );
+  }
+
+ private:
+  QAD_Study* myStudy;
+  bool       myUpdateSel;
+};
+// PAL8065: san
 
 SUPERVGUI_Main::SUPERVGUI_Main(SUPERVGraph_ViewFrame* theParent, QAD_Desktop* theDesktop, SUPERV_Graph theDataFlow )
      : SUPERVGraph_View(theParent),
@@ -275,14 +292,18 @@ void SUPERVGUI_Main::sync() {
   
   t += dataflow->Name();
   setCaption(t);
+  
+  // PAL8065: san
+  ProcessVoidEvent( new UpdateEvent( study ) );
 
-  study->updateObjBrowser();
   if (myCurrentView == CANVASTABLE) {
-    myArray->sync();
-    myArray->update();
+    // PAL8065: san
+    ProcessVoidEvent( new TCanvasArrayEvent( myArray, &SUPERVGUI_CanvasArray::sync ) );
+    ProcessVoidEvent( new TCanvasArrayEvent( myArray, &SUPERVGUI_CanvasArray::update ) );
   } else {
-    myCanvas->sync();
-    myCanvas->update();
+    // PAL8065: san
+    ProcessVoidEvent( new TCanvasEvent( myCanvas, &SUPERVGUI_Canvas::sync ) );
+    ProcessVoidEvent( new TCanvasEvent( myCanvas, &SUPERVGUI_Canvas::update ) );
   }
 }