Index: src/hg/hgTables/mainPage.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTables/mainPage.c,v
retrieving revision 1.144
retrieving revision 1.145
diff -b -B -U 4 -r1.144 -r1.145
--- src/hg/hgTables/mainPage.c	20 May 2009 20:59:56 -0000	1.144
+++ src/hg/hgTables/mainPage.c	4 Jan 2010 19:12:23 -0000	1.145
@@ -792,17 +792,20 @@
         struct grp *selGroup = findSelectedGroup(groupList, hgtaCorrelateGroup);
         struct trackDb *tdb2 = findSelectedTrack(fullTrackList, selGroup,hgtaCorrelateTrack);
         if (tdbIsComposite(tdb2))
             {
-            struct trackDb *subTdb;
-            for (subTdb=tdb2->subtracks; subTdb != NULL; subTdb=subTdb->next)
+	    struct slRef *tdbRefList = trackDbListGetRefsToDescendantLeaves(tdb2->subtracks);
+	    struct slRef *tdbRef;
+	    for (tdbRef = tdbRefList; tdbRef != NULL; tdbRef = tdbRef->next)
                 {
+		struct trackDb *subTdb = tdbRef->val;
                 if (sameString(table2, subTdb->tableName))
                     {
                     tdb2 = subTdb;
                     break;
                     }
                 }
+	    slFreeList(&tdbRefList);
             }
         cgiMakeButton(hgtaDoCorrelatePage, "calculate");
         cgiMakeButton(hgtaDoClearCorrelate, "clear");
         if (tdb2 && tdb2->shortLabel)

