]> OCCT Git - occt.git/commitdiff
0029841: Test cases from tools/dfbrowser periodically hang on Windows platform
authornds <nds@opencascade.com>
Thu, 7 Jun 2018 12:59:03 +0000 (15:59 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 14 Jun 2018 11:03:12 +0000 (14:03 +0300)
Do not start new thread if the thread has been already started. Restart the thread after the previous has finished.

tests/tools/dfbrowser/A9 [new file with mode: 0644]
tools/DFBrowser/DFBrowser_Thread.cxx
tools/DFBrowser/DFBrowser_Thread.hxx

diff --git a/tests/tools/dfbrowser/A9 b/tests/tools/dfbrowser/A9
new file mode 100644 (file)
index 0000000..701be36
--- /dev/null
@@ -0,0 +1,12 @@
+puts "========"
+puts "0029841: Test cases from tools/dfbrowser periodically hang on Windows platform"
+puts "========"
+
+pload INSPECTOR
+
+tinspector -plugins dfbrowser
+
+for { set i 1 } { ${i} <= 10 } { incr i } {
+  tinspector -open [locate_data_file bug29743.cbf] -select 0 TNaming_UsedShapes
+  tinspector -open [locate_data_file bug29733.cbf] -select 0 TNaming_UsedShapes
+}
index c20ee510a19d9e54513737e770bc9f01c599709b..00e6649cfaa06a20cff8bdc760b51d24ae1eb360 100644 (file)
@@ -62,7 +62,8 @@ private:
 // purpose :
 // =======================================================================
 DFBrowser_Thread::DFBrowser_Thread (DFBrowser_Window* theWindow)
-: QObject (theWindow), myPostponedItem (0), myIsFinishProcessing (false)
+: QObject (theWindow), myPostponedItem (0), myIsFinishProcessing (false),
+  myIsProcessPostponed (Standard_False)
 {
   DFBrowser_SearchLine* aSearchLine = theWindow->GetTreeLevelLine()->GetSearchLine();
   myItems.append (new DFBrowser_ThreadItemSearch(aSearchLine));
@@ -74,6 +75,11 @@ DFBrowser_Thread::DFBrowser_Thread (DFBrowser_Window* theWindow)
 // =======================================================================
 void DFBrowser_Thread::ProcessApplication()
 {
+  if (!myStartedThreads.empty())
+  {
+    myIsProcessPostponed = Standard_True;
+    return;
+  }
   for (int anItemId = 0, aSize = myItems.size(); anItemId < aSize; anItemId++)
     startThread (myItems[anItemId]);
 }
@@ -135,4 +141,10 @@ void DFBrowser_Thread::onFinished()
     myPostponedItem->ApplyValues();
     myPostponedItem = 0;
   }
+
+  if (myIsProcessPostponed)
+  {
+    myIsProcessPostponed = Standard_False;
+    ProcessApplication();
+  }
 }
index b6a11d96326742938be235d1b32ab00371a83aae..f6e3465fed9ae193bd78660471a1cad54496e719 100644 (file)
@@ -67,6 +67,7 @@ private:
   QList<QThread*> myStartedThreads; //!< container of started threads
   DFBrowser_ThreadItem* myPostponedItem; //!< currently processed item in onFinished()
   bool myIsFinishProcessing; //!< blocking state if onFinished() is started but has not been finished yet
+  Standard_Boolean myIsProcessPostponed; //!< state if process application should be done by finish active thread
 };