b0828e726eba3cbd345f94f1ed0ad1b334424f7d
angie
  Thu Mar 14 10:38:31 2013 -0700
Fixing bug reported via MLQ: When repeatedly adding/modifying customtracks and saving sessions without any cartResets or session loads,
the same ctfile was used in both saved sessions and the user's active
cart, so modifications after saving a session were leaking back to
saved sessions.  Fix: copy custom tracks not only when loading a
saved session, but also immediately after saving a session, so that
the user's active cart no longer has the same ctfile (and customTrash
database tables, etc) as the saved session.
fixes #10396, refs #10323

diff --git src/hg/inc/cart.h src/hg/inc/cart.h
index 273443a..4a9261e 100644
--- src/hg/inc/cart.h
+++ src/hg/inc/cart.h
@@ -539,21 +539,25 @@
                             boolean ignoreRemoved,boolean ignoreCreated);
 /* Returns TRUE if new cart setting has changed from old cart setting */
 
 int cartRemoveFromTdbTree(struct cart *cart,struct trackDb *tdb,char *suffix,boolean skipParent);
 /* Removes a 'trackName.suffix' from all tdb descendents (but not parent).
    If suffix NULL then removes 'trackName' which holds visibility */
 
 boolean cartTdbTreeReshapeIfNeeded(struct cart *cart,struct trackDb *tdbComposite);
 /* When subtrack vis is set via findTracks, and composite has no cart settings,
    then fashion composite to match found */
 
 boolean cartTdbTreeCleanupOverrides(struct trackDb *tdb,struct cart *newCart,struct hash *oldVars, struct lm *lm);
 /* When composite/view settings changes, remove subtrack specific settings
    Returns TRUE if any cart vars are removed */
 
+void cartCopyCustomTracks(struct cart *cart, char *db);
+/* If cart contains any live custom tracks, save off a new copy of them,
+ * to prevent clashes by multiple uses of the same session.  */
+
 void cgiExitTime(char *cgiName, long enteredMainTime);
 /* single stderr print out called at end of CGI binaries to record run
  * time in apache error_log */
 
 #endif /* CART_H */