7d448227a9ce33288ecae8cbf6d9a9ef0111c034
galt
  Thu Oct 14 00:33:49 2021 -0700
Needed to wait until the process had gotten further than track loading before using ss spaceSaver. fixes #28291

diff --git src/hg/hgTracks/barChartTrack.c src/hg/hgTracks/barChartTrack.c
index 05f5ec4..85bcd5e 100644
--- src/hg/hgTracks/barChartTrack.c
+++ src/hg/hgTracks/barChartTrack.c
@@ -851,59 +851,63 @@
     // for visibility, set larger than the usual squish, which is half font height
     struct barChartTrack *extras = (struct barChartTrack *)tg->extraUiData;
     heightPer = extras->squishHeight * 2;  // the squish packer halves this
     lineHeight=heightPer+1;
     }
 else if ((vis == tvPack) || (vis == tvFull))
     {
     heightPer = tl.fontHeight;
     lineHeight=heightPer;
     }
 
 height = tgFixedTotalHeightOptionalOverflow(tg, vis, lineHeight, heightPer, FALSE);
 
 if ((vis == tvPack) || (vis == tvFull))
     {
+    // set variable height rows
+
+    if (tg->ss)  // got past trackLoadingInProgress
+	{
 	struct spaceSaver *ss = findSpaceSaver(tg, vis); // ss is a list now
 	assert(ss); // viz matches, we have the right one
 
-    // set variable height rows
-    if (ss && ss->rowCount)
+	if (ss && ss->rowCount != 0)
 	    {
 	    if (!ss->rowSizes)
 		{
 		// collect the rowSizes data across all windows
 		assert(currentWindow==windows); // first window
 		assert(tg->ss->vis == vis); // viz matches, we have the right one
 		struct spaceSaver *ssHold; 
 		AllocVar(ssHold);
 		struct track *tgSave = tg;
 		for(tg=tgSave; tg; tg=tg->nextWindow)
 		    {
 		    assert(tgSave->ss->vis == tg->ss->vis); // viz matches, we have the right one
 		    spaceSaverSetRowHeights(tg->ss, ssHold, getBarChartHeight);
 		    }
 		// share the rowSizes data across all windows
 		for(tg=tgSave; tg; tg=tg->nextWindow)
 		    {
 		    tg->ss->rowSizes = ssHold->rowSizes;
 		    }
 		tg = tgSave;
 		}
 	    height = spaceSaverGetRowHeightsTotal(ss);
 	    }
 	}
+    }
 tg->height = height;
 
 return height;
 }
 
 static void barChartPreDrawItems(struct track *tg, int seqStart, int seqEnd,
                                 struct hvGfx *hvg, int xOff, int yOff, int width,
                                 MgFont *font, Color color, enum trackVisibility vis)
 {
 if (vis == tvSquish || vis == tvDense)
     {
     // NonProp routines not relevant to these modes, and they interfere
     // NOTE: they must be installed by barChartMethods() for pack mode
     tg->nonPropDrawItemAt = NULL;
     tg->nonPropPixelWidth = NULL;