c0b183c96763a6ebf2c050e82859373309a2befe
angie
  Fri Oct 31 17:19:56 2014 -0700
When lookupPosition() returns false (multiple search results), thesubsequent call to doMainPage(conn, TRUE) was causing a popWarnHandler
underflow errAbort because doMainPage ends with an htmlClose (which
btw invokes popWarnHandler three times: one directly, once in
cartWebEnd and once in webEnd).  The symptom was that changes made to
the main page form before looking up a term that returned multiple
results were lost because the underflow errAbort prevented the cart
from being saved.  The solution is to not use doMainPage(conn, TRUE)
but instead to call mainPageAfterOpen enclosed by push and pop of
web warn/error handlers.

Since doMainPage(conn, TRUE) caused trouble that can be avoided by
calling mainPageAfterOpen, I removed the option.

I also removed dead code doLookupPosition; dispatch is called only
when lookupPosition() has already returned a single match, so the
work is already done and it will default to the main page anyway.

refs #12557

diff --git src/hg/hgTables/intersect.c src/hg/hgTables/intersect.c
index 2e0d618..1294ebd 100644
--- src/hg/hgTables/intersect.c
+++ src/hg/hgTables/intersect.c
@@ -306,38 +306,38 @@
 
 
 void doIntersectPage(struct sqlConnection *conn)
 /* Respond to intersect create/edit button */
 {
 if (ArraySize(curVars) != ArraySize(nextVars))
     internalErr();
 copyCartVars(cart, curVars, nextVars, ArraySize(curVars));
 doIntersectMore(conn);
 }
 
 void doClearIntersect(struct sqlConnection *conn)
 /* Respond to click on clear intersection. */
 {
 removeCartVars(cart, curVars, ArraySize(curVars));
-doMainPage(conn, FALSE);
+doMainPage(conn);
 }
 
 void doIntersectSubmit(struct sqlConnection *conn)
 /* Respond to submit on intersect page. */
 {
 copyCartVars(cart, nextVars, curVars, ArraySize(curVars));
-doMainPage(conn, FALSE);
+doMainPage(conn);
 }
 
 
 static void bitSetClippedRange(Bits *bits, int bitSize, int s, int e)
 /* Clip start and end to [0,bitSize) and set range. */
 {
 int w;
 if (e > bitSize) e = bitSize;
 if (s < 0) s = 0;
 w = e - s;
 if (w > 0)
     bitSetRange(bits, s, w);
 }
 
 static void bedOrBits(Bits *bits, int bitSize, struct bed *bedList,