mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 19:02:59 +00:00
plug QUnifiedTimer, QtFreetypeData and QHttpThreadDelegate memory leaks
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
359ae27e61
commit
d0c0187ed3
4 changed files with 30 additions and 7 deletions
|
@ -24,6 +24,25 @@ QT_BEGIN_NAMESPACE
|
|||
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 */
|
||||
|
||||
|
|
|
@ -125,11 +125,11 @@
|
|||
#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
|
||||
|
||||
|
@ -138,7 +138,7 @@
|
|||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
thread_local QUnifiedTimer* unifiedTimer = nullptr;
|
||||
QTHREADLOCAL(QUnifiedTimer, unifiedTimer);
|
||||
|
||||
QUnifiedTimer::QUnifiedTimer() :
|
||||
QObject(), lastTick(0), currentAnimationIdx(0), insideTick(false),
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "qharfbuzz_p.h"
|
||||
#include "qfontengine_ft_p.h"
|
||||
#include "qguicommon_p.h"
|
||||
#include "qcorecommon_p.h"
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
|
@ -78,7 +79,7 @@ public:
|
|||
QHash<QFontEngine::FaceId, QFreetypeFace *> faces;
|
||||
};
|
||||
|
||||
thread_local QtFreetypeData* theFreetypeData = nullptr;
|
||||
QTHREADLOCAL(QtFreetypeData, theFreetypeData);
|
||||
|
||||
QtFreetypeData *qt_getFreetypeData()
|
||||
{
|
||||
|
|
|
@ -160,6 +160,8 @@ QHttpThreadDelegate::~QHttpThreadDelegate()
|
|||
// and release the entry for this QHttpNetworkConnection
|
||||
if (connections && !cacheKey.isEmpty()) {
|
||||
connections->releaseEntry(cacheKey);
|
||||
delete connections;
|
||||
connections = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -202,6 +204,7 @@ void QHttpThreadDelegate::startRequestSynchronously()
|
|||
synchronousRequestLoop.exec();
|
||||
|
||||
connections->releaseEntry(cacheKey);
|
||||
delete connections;
|
||||
connections = nullptr;
|
||||
|
||||
#ifdef QHTTPTHREADDELEGATE_DEBUG
|
||||
|
|
Loading…
Add table
Reference in a new issue