faa702a31e3a404ab0cd93c3180ad65cefd6ed09
tdreszer
  Tue Oct 12 20:06:42 2010 -0700
Two paths to cleanup and both may require superTrack vis adjustments
diff --git src/hg/hgTracks/hgTracks.c src/hg/hgTracks/hgTracks.c
index c9243ba..791ab51 100644
--- src/hg/hgTracks/hgTracks.c
+++ src/hg/hgTracks/hgTracks.c
@@ -4273,14 +4273,20 @@
 struct track *track = trackList;
 for (;track != NULL; track = track->next)
     {
+    boolean cleanedUp = FALSE;
+
     if (tdbIsContainer(track->tdb))
-        if(cartTdbTreeMatchSubtrackVis(cart,track->tdb))
+        {
+        cleanedUp = cartTdbTreeMatchSubtrackVis(cart,track->tdb);
+        if(cleanedUp)
             track->visibility = tdbVisLimitedByAncestry(cart,track->tdb,FALSE);
+        }
 
     if (cartTdbTreeCleanupOverrides(track->tdb,newCart,oldVars))
+        cleanedUp = TRUE; // 2 ways to clean up!
+
+    if (cleanedUp && tdbIsSuperTrackChild(track->tdb))  // Either cleanup may require supertrack intervention
         { // Need to update track visibility
-        if (tdbIsSuperTrackChild(track->tdb))
-            {
             // Unfortunately, since supertracks are not in trackList, this occurs on superChildren,
             // So now we need to find the supertrack and take changed cart values of its children
             struct slRef *childRef;
@@ -4295,7 +4301,6 @@
             }
         }
     }
-}
 #endif///def SUBTRACKS_HAVE_VIS
 
 void doTrackForm(char *psOutput, struct tempName *ideoTn)