ajaxorg/ace — pull request #1925 by ggoodman (2014-04-24 19:46:15+00:00)
Title: Prevent repeat firing of render callback

**Issue**

If either the theme or mode are already cached, callback will be fired more than once.

This is because `config.loadModule` appears to fire its callback synchronously. This means that in the event that the theme is already cached, `waiting` will first be incremented then decremented in the same pass, resulting in `done` being called a first time.

Control will then flow to the `return` statement where waiting is still `0` and so the `callback` will fire a 2nd time.

**Changes**

Instead of changing the semantics of `config.loadModule`, I increment waiting at creation so that it will never fire until at least line 130 (`return` statement).