diff transform/TransformFactory.cpp @ 473:47b41ec34407

* Avoid waiting on uninstalled transforms mutex in TransformFactory:: getTransformInstallStatus -- we can return TransformUnknown * Don't follow link in SelectableLabel when clicking to select it * Restore lost version number in plugin param dialog
author Chris Cannam
date Tue, 28 Oct 2008 18:06:06 +0000
parents 5015e80cc919
children a70dcfed59c1
line wrap: on
line diff
--- a/transform/TransformFactory.cpp	Tue Oct 28 12:39:53 2008 +0000
+++ b/transform/TransformFactory.cpp	Tue Oct 28 18:06:06 2008 +0000
@@ -134,14 +134,29 @@
 TransformFactory::getTransformInstallStatus(TransformId id)
 {
     populateTransforms();
-    populateUninstalledTransforms();
 
     if (m_transforms.find(id) != m_transforms.end()) {
         return TransformInstalled;
     }
+    
+    if (!m_uninstalledTransformsMutex.tryLock()) {
+        // uninstalled transforms are being populated; this may take some time,
+        // and they aren't critical
+        return TransformUnknown;
+    }
+
+    if (!m_uninstalledTransformsPopulated) {
+        m_uninstalledTransformsMutex.unlock();
+        populateUninstalledTransforms();
+        m_uninstalledTransformsMutex.lock();
+    }
+
     if (m_uninstalledTransforms.find(id) != m_uninstalledTransforms.end()) {
         return TransformNotInstalled;
     }
+
+    m_uninstalledTransformsMutex.unlock();
+
     return TransformUnknown;
 }