arraytype arrayname[arraysize]; \
::memset(arrayname, 0, arraysize * sizeof(arraytype));
+template <typename T>
+class QThreadLocalDeleter
+{
+public:
+ T* threadLocal;
+ QThreadLocalDeleter(T* _threadLocal)
+ : threadLocal(_threadLocal)
+ { }
+
+ inline ~QThreadLocalDeleter()
+ {
+ delete threadLocal;
+ }
+};
+
+#define QTHREADLOCAL(localtype, localname) \
+ thread_local localtype* localname(nullptr); \
+ thread_local QThreadLocalDeleter<localtype> localname## _deleter(localname);
+
static const qreal q_deg2rad = qreal(0.01745329251994329576923690768489); /* pi/180 */
static const qreal q_rad2deg = qreal(57.295779513082320876798154814105); /* 180/pi */
#include "qabstractanimation.h"
#include "qanimationgroup.h"
#include "qabstractanimation_p.h"
-
-#include <QtCore/qdebug.h>
-#include <QtCore/qmath.h>
-#include <QtCore/qcoreevent.h>
-#include <QtCore/qpointer.h>
+#include "qdebug.h"
+#include "qmath.h"
+#include "qcoreevent.h"
+#include "qpointer.h"
+#include "qcorecommon_p.h"
#ifndef QT_NO_ANIMATION
QT_BEGIN_NAMESPACE
-thread_local QUnifiedTimer* unifiedTimer = nullptr;
+QTHREADLOCAL(QUnifiedTimer, unifiedTimer);
QUnifiedTimer::QUnifiedTimer() :
QObject(), lastTick(0), currentAnimationIdx(0), insideTick(false),
#include "qharfbuzz_p.h"
#include "qfontengine_ft_p.h"
#include "qguicommon_p.h"
+#include "qcorecommon_p.h"
#include <ft2build.h>
#include FT_FREETYPE_H
QHash<QFontEngine::FaceId, QFreetypeFace *> faces;
};
-thread_local QtFreetypeData* theFreetypeData = nullptr;
+QTHREADLOCAL(QtFreetypeData, theFreetypeData);
QtFreetypeData *qt_getFreetypeData()
{
// and release the entry for this QHttpNetworkConnection
if (connections && !cacheKey.isEmpty()) {
connections->releaseEntry(cacheKey);
+ delete connections;
+ connections = nullptr;
}
}
synchronousRequestLoop.exec();
connections->releaseEntry(cacheKey);
+ delete connections;
connections = nullptr;
#ifdef QHTTPTHREADDELEGATE_DEBUG