1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

fix crash on exit

This commit is contained in:
krepa098 2015-02-04 09:40:23 +01:00
parent 7321127794
commit 09291bad52
4 changed files with 4 additions and 7 deletions

View File

@ -17,8 +17,6 @@
#include "documentcache.h" #include "documentcache.h"
#include "customtextdocument.h" #include "customtextdocument.h"
DocumentCache DocumentCache::instance;
DocumentCache::~DocumentCache() DocumentCache::~DocumentCache()
{ {
while(!documents.isEmpty()) while(!documents.isEmpty())
@ -35,10 +33,12 @@ QTextDocument* DocumentCache::pop()
void DocumentCache::push(QTextDocument *doc) void DocumentCache::push(QTextDocument *doc)
{ {
documents.push(doc); if(doc)
documents.push(doc);
} }
DocumentCache &DocumentCache::getInstance() DocumentCache &DocumentCache::getInstance()
{ {
static DocumentCache instance;
return instance; return instance;
} }

View File

@ -37,7 +37,6 @@ protected:
private: private:
QStack<QTextDocument*> documents; QStack<QTextDocument*> documents;
static DocumentCache instance;
}; };
#endif // DOCUMENTCACHE_H #endif // DOCUMENTCACHE_H

View File

@ -16,8 +16,6 @@
#include "pixmapcache.h" #include "pixmapcache.h"
PixmapCache PixmapCache::instance;
QPixmap PixmapCache::get(const QString &filename, QSize size) QPixmap PixmapCache::get(const QString &filename, QSize size)
{ {
auto itr = cache.find(filename); auto itr = cache.find(filename);
@ -36,6 +34,7 @@ QPixmap PixmapCache::get(const QString &filename, QSize size)
PixmapCache &PixmapCache::getInstance() PixmapCache &PixmapCache::getInstance()
{ {
static PixmapCache instance;
return instance; return instance;
} }

View File

@ -34,7 +34,6 @@ protected:
private: private:
QHash<QString, QIcon> cache; QHash<QString, QIcon> cache;
static PixmapCache instance;
}; };
#endif // ICONCACHE_H #endif // ICONCACHE_H