Steps to reproduce:
1. Start viewer and change language to Japanese.
2. Launch viewer again and log in.
3. Viewer crahes and "Bad memory allocation in LLAppViewer::mainLoop()!" message appears.
Viewer crashes always, both on Windows and Linux. Bug reproduces not only on fresh code, but at least on changeset 50687ce6ba72 which is two weeks old too.
Debugging around a bit helped to find where approximately happens the crash:
In idle_startup() => if (STATE_WORLD_INIT == LLStartUp::getStartupState()) => display_startup() => gViewerWindow->draw()
When we get there, somewhere inside mRootView->draw() we have a problem that leads to crash.