Gnats 4677: Assertion: Canceling Exchange creation after an error attempt. ALSO: Insure uniqueness of Exchange Names. The problem is a bug in the application of the new Exchange's Input Borrow Supply (the only Supply ever actually owned by the Exchange). Since uniqueness of Exchange Names was not being enforced, and since the name of the Input Borrow Supply is completely based on the Exchange name, a bug was manifesting in the AccountMgr's _supplies cwHashMap (due to a collision). The easiest, and most productive solution to this problem is enforcing uniqueness of Exchange names. The following changes have been made: (1) When creating a new Exchange (with the use of the ExchangeCfgDlg), start the Exchange off with a unique name, either NewExchange, or NewExchangeXXX (where XXX represents an integer with at least three characters, starting at '001'). (2) When applying changes to an Exchange in the ExchangeCfgDlg, insure that the entered Exchange name is still unique. If not, block the application of the changes (and show an error message box). ------------------------- Accounting/AccountMgr.cpp Accounting/AccountMgr.hpp ------------------------- New method: // This method checks if the name exists and, in the case that it does, // adds an integer index onto the end. void createUniqueExchangeName (RWCString &newName); Added optional parameter: const Exchange *getExchange (const RWCString &name, const Exchange* excludingExch=NULL) const; ----------------------- Accounting/Exchange.cpp ----------------------- In constructor, if the given name for the Exchange is not unique, compute a unique name using AccountingMgr::createUniqueExchangeName (RWCString&); ------------------------------- QtAccounting/ExchangeMgrDlg.cpp ------------------------------- When creating a new Exchange, explicitly provide a base Exchange Name ("NewExchange") instead of allowing use of the default parameter ("unnamed"). Change in method: void ExchangeMgrDlg::newExchangesHandler(); Note that a modification to the Exchange contructor will ensure that the provided name is unique, or else it will append some decimal digits to make it unique (at least three characters, starting at 001). ------------------------------- QtAccounting/ExchangeCfgDlg.cpp ------------------------------- Before applying changes to an Exchange, insure that the entered Exchange Name isn't the same as any other Exchange. Change in: bool ExchangeCfgDlg::checkInputs() ---