a604cf00db3b556b90e1f0b60d7cbef8b81017ec kate Mon Mar 27 12:32:36 2017 -0700 Fix reentrancy problem. refs #18736 diff --git src/hg/lib/barChartUi.c src/hg/lib/barChartUi.c index 3c4190c..eca370a 100644 --- src/hg/lib/barChartUi.c +++ src/hg/lib/barChartUi.c @@ -2,30 +2,31 @@ /* Copyright (C) 2015 The Regents of the University of California * See README in this or parent directory for licensing information. */ #include "cheapcgi.h" #include "cart.h" #include "hui.h" #include "trackDb.h" #include "jsHelper.h" #include "hCommon.h" #include "rainbow.h" #include "barChartCategory.h" #include "barChartUi.h" /* Restrict features on right-click (popup) version */ +/* FIXME: NOT STATIC */ static boolean isPopup = FALSE; /* Convenience functions for category filter controls */ char *makeCategoryLabel(struct barChartCategory *categ) /* Display category color and label */ { char buf[256]; safef(buf, sizeof(buf), "<td class='bcColorPatch' bgcolor=%X></td>" "<td> %s</td>", categ->color, categ->label); return(cloneString(buf)); } @@ -145,35 +146,31 @@ cgiMakeIntVarWithExtra(cartVar, viewMax, 4, isLogTransform ? "disabled" : ""); printf("<span class='%s'> (range 0-%d)</span>\n", buf, round(barChartUiMaxMedianScore())); } char *barChartUiGetLabel(char *database, struct trackDb *tdb) /* Get label for category list */ { return trackDbSettingClosestToHomeOrDefault(tdb, BAR_CHART_CATEGORY_LABEL, BAR_CHART_CATEGORY_LABEL_DEFAULT); } struct barChartCategory *barChartUiGetCategories(char *database, struct trackDb *tdb) /* Get category colors and descriptions. If barChartLabel setting contains label list, assign rainbow colors. * O/w look for a table naed track+Category, and use labels and colors there */ { -static struct barChartCategory *categs; - -if (categs != NULL) - return categs; - +struct barChartCategory *categs = NULL; char *words[BAR_CHART_MAX_CATEGORIES]; char *labels = trackDbSettingClosestToHome(tdb, BAR_CHART_CATEGORY_LABELS); struct barChartCategory *categ = NULL; if (!labels) { categs = barChartGetCategories(database, tdb->table); } else { int count = chopLine(cloneString(labels), words); struct rgbColor *rainbow = getRainbow(&saturatedRainbowAtPos, count); int i; char buf[6]; for (i=0; i<count; i++)