Use Q_GLOBAL_STATIC() to manage the per-thread arrays of proxies

The QThreadStorage instance must have a lifetime greater than
the objects it manages.