c808a134567ebbafe16bf422ac5c605bcce2a3ac
tdreszer
  Tue Nov 2 14:59:50 2010 -0700
Found recursive loop that wigMafs fell into with rightClick.  The particular code may not actually be needed and has been ifdef'd OMITted.
diff --git src/hg/hgTracks/hgTracks.c src/hg/hgTracks/hgTracks.c
index af42966..e53a98d 100644
--- src/hg/hgTracks/hgTracks.c
+++ src/hg/hgTracks/hgTracks.c
@@ -1562,33 +1562,42 @@
 {
 #ifdef SUBTRACKS_HAVE_VIS
 if (tdbIsCompositeChild(subtrack->tdb))
     {
     if (fourStateVisible(subtrackFourStateChecked(subtrack->tdb,cart))) // Don't need all 4 states here.  Visible=checked&&enabled
         {
         char *var = cartOptionalString(cart, subtrack->track);
         if (var)
             {
             subtrack->visibility = hTvFromString(var);
 
             if (subtrack->limitedVisSet)
                 subtrack->limitedVis = tvMin(subtrack->visibility,subtrack->limitedVis);
             else
                 {
+                #ifdef OMIT
+                // Not sure this is needed at all!  OMITting because of the recursive loop that wigMafs fell into on rightClick
                 if (subtrack->visibility != tvHide && slCount(subtrack->items) == 0)
+                    {
+                    // wigMaf legitimately has no items even after loadItems, as it triggers a loop to ->loadItems() !
+                    // Really should protect against infinite loops better than this!
+                    if (!startsWith("wigMaf", subtrack->tdb->type) && !startsWith("maf", subtrack->tdb->type))
+                        {
                         subtrack->loadItems(subtrack);
-
+                        }
+                    }
+                #endif///def OMIT
                 limitVisibility(subtrack);
                 }
             return hTvFromString(var);
             }
         }
     else
         return tvHide;
     }
 #endif///def SUBTRACKS_HAVE_VIS
 
 enum trackVisibility vis = subtrack->limitedVis == tvHide ?
                            subtrack->visibility :
                            tvMin(subtrack->visibility,subtrack->limitedVis);
 struct trackDb *tdb = subtrack->tdb;
 if(tdbIsCompositeChild(tdb))