template class QGlobalStatic { public: QBasicAtomicPointer pointer; bool destroyed; }; template class QGlobalStaticDeleter { public: QGlobalStatic &globalStatic; QGlobalStaticDeleter(QGlobalStatic &_globalStatic) : globalStatic(_globalStatic) { } inline ~QGlobalStaticDeleter() { delete globalStatic.pointer; globalStatic.pointer = 0; globalStatic.destroyed = true; } };