From 652d966eb8c007ba9c271980be467fc3591efe7f Mon Sep 17 00:00:00 2001 From: Anatoly Mihalchenko Date: Thu, 10 Nov 2011 19:03:13 +0300 Subject: [PATCH] Memory leaks fixing --- src/adaptors/UBCFFSubsetAdaptor.cpp | 2 ++ src/adaptors/UBImportCFF.cpp | 3 +- src/adaptors/UBSvgSubsetAdaptor.cpp | 2 -- src/adaptors/UBWebPublisher.cpp | 4 +-- .../publishing/UBDocumentPublisher.cpp | 3 +- src/board/UBDrawingController.cpp | 7 +++++ src/board/UBDrawingController.h | 1 + src/board/UBLibraryController.cpp | 5 +++- src/board/UBLibraryController.h | 4 +-- src/core/UBApplication.cpp | 28 ++++++++++++------- src/core/UBDocumentManager.cpp | 3 +- src/core/UBDownloadManager.cpp | 11 ++++++++ src/core/UBDownloadManager.h | 8 ++++-- src/core/UBDownloadThread.cpp | 2 ++ src/core/UBPersistenceManager.cpp | 7 +++++ src/core/UBPersistenceManager.h | 1 + src/core/UBSettings.cpp | 17 +++++++++++ src/core/UBSettings.h | 9 ++---- src/core/main.cpp | 4 ++- src/domain/UBGraphicsItemDelegate.cpp | 1 + src/domain/UBGraphicsPolygonItem.cpp | 22 +++++++++------ src/domain/UBGraphicsPolygonItem.h | 3 ++ src/domain/UBGraphicsScene.cpp | 19 +++++++++++-- src/domain/UBGraphicsStroke.cpp | 7 +++++ src/domain/UBGraphicsStroke.h | 9 ++++-- src/frameworks/UBCryptoUtils.cpp | 15 ++++++++++ src/frameworks/UBCryptoUtils.h | 8 ++---- src/frameworks/UBDesktopServices.h | 2 ++ src/gui/UBCachePropertiesWidget.cpp | 2 ++ src/gui/UBDockPaletteWidget.cpp | 2 ++ src/gui/UBDownloadWidget.cpp | 2 ++ src/gui/UBLeftPalette.cpp | 2 ++ src/gui/UBLibNavigatorWidget.cpp | 5 ++-- src/gui/UBLibPathViewer.cpp | 20 ++++++------- src/gui/UBLibWebView.cpp | 2 ++ src/gui/UBLibWidget.cpp | 3 +- src/gui/UBLibraryWidget.cpp | 9 ++---- src/gui/UBMagnifer.cpp | 2 ++ src/gui/UBRightPalette.cpp | 2 ++ src/gui/UBRubberBand.cpp | 13 +++++---- src/gui/UBRubberBand.h | 2 ++ src/gui/UBTeacherBarWidget.cpp | 2 ++ src/gui/UBThumbnailWidget.cpp | 4 +-- src/pdf-merger/ASCII85Decode.cpp | 3 ++ src/pdf-merger/ASCIIHexDecode.cpp | 2 ++ src/pdf-merger/AnnotsHandler.cpp | 2 ++ src/pdf-merger/ContentHandler.cpp | 2 ++ src/pdf-merger/Document.cpp | 2 ++ src/pdf-merger/Filter.cpp | 2 ++ src/pdf-merger/FilterPredictor.cpp | 2 ++ src/pdf-merger/FlateDecode.cpp | 2 ++ src/pdf-merger/LZWDecode.cpp | 2 ++ src/pdf-merger/Merger.cpp | 2 ++ src/pdf-merger/Object.cpp | 2 ++ src/pdf-merger/OverlayDocumentParser.cpp | 2 ++ src/pdf-merger/Page.cpp | 2 ++ src/pdf-merger/PageElementHandler.cpp | 2 ++ src/pdf-merger/Parser.cpp | 2 ++ src/pdf-merger/Rectangle.cpp | 2 ++ src/pdf-merger/RemoveHimselfHandler.cpp | 2 ++ src/pdf-merger/RunLengthDecode.cpp | 2 ++ src/pdf-merger/Utils.cpp | 2 ++ src/podcast/UBAbstractVideoEncoder.cpp | 2 ++ src/podcast/UBPodcastController.cpp | 1 + src/podcast/UBPodcastRecordingPalette.cpp | 1 + .../intranet/UBIntranetPodcastPublisher.cpp | 2 ++ .../quicktime/UBAudioQueueRecorder.cpp | 1 + src/podcast/quicktime/UBQuickTimeFile.cpp | 2 ++ .../quicktime/UBQuickTimeVideoEncoder.cpp | 1 + src/podcast/windowsmedia/UBWaveRecorder.cpp | 2 ++ .../windowsmedia/UBWindowsMediaFile.cpp | 2 ++ .../UBWindowsMediaVideoEncoder.cpp | 1 + src/podcast/youtube/UBYouTubePublisher.cpp | 2 ++ src/softwareupdate/UBRssHandler.cpp | 2 ++ src/softwareupdate/UBSoftwareUpdate.cpp | 2 ++ src/tools/UBGraphicsCache.cpp | 1 + src/tools/UBToolsManager.cpp | 15 ++++++++++ src/tools/UBToolsManager.h | 8 ++---- src/transition/UniboardSankoreTransition.cpp | 2 ++ src/web/UBRoutedMouseEventWebView.cpp | 2 ++ src/web/UBTrapFlashController.cpp | 1 + src/web/UBWebController.cpp | 1 + src/web/UBWebKitUtils.cpp | 2 ++ src/web/UBWebPage.cpp | 2 ++ src/web/UBWebPluginWidget.cpp | 2 ++ src/web/browser/WBBrowserWindow.cpp | 1 + src/web/browser/WBChaseWidget.cpp | 2 ++ src/web/browser/WBDownloadManager.cpp | 2 ++ src/web/browser/WBEditTableView.cpp | 2 ++ src/web/browser/WBHistory.cpp | 1 + src/web/browser/WBModelMenu.cpp | 2 ++ src/web/browser/WBSearchLineEdit.cpp | 2 ++ src/web/browser/WBSqueezeLabel.cpp | 2 ++ src/web/browser/WBTabWidget.cpp | 2 ++ src/web/browser/WBToolBarSearch.cpp | 2 ++ src/web/browser/WBUrlLineEdit.cpp | 2 ++ src/web/browser/WBWebTrapWebView.cpp | 2 ++ src/web/browser/WBWebView.cpp | 1 + 98 files changed, 314 insertions(+), 84 deletions(-) diff --git a/src/adaptors/UBCFFSubsetAdaptor.cpp b/src/adaptors/UBCFFSubsetAdaptor.cpp index 5e970806..b22ad3b0 100644 --- a/src/adaptors/UBCFFSubsetAdaptor.cpp +++ b/src/adaptors/UBCFFSubsetAdaptor.cpp @@ -41,6 +41,8 @@ #include +#include "core/memcheck.h" + //enum of xmlparse status //tag names definition diff --git a/src/adaptors/UBImportCFF.cpp b/src/adaptors/UBImportCFF.cpp index f6554415..d4059982 100644 --- a/src/adaptors/UBImportCFF.cpp +++ b/src/adaptors/UBImportCFF.cpp @@ -18,7 +18,6 @@ #include "core/UBApplication.h" #include "core/UBPersistenceManager.h" #include "core/UBDocumentManager.h" -#include "core/memcheck.h" #include "core/UBPersistenceManager.h" #include "document/UBDocumentProxy.h" #include "domain/UBGraphicsPDFItem.h" @@ -32,6 +31,8 @@ #include "quazipfile.h" #include "quazipfileinfo.h" +#include "core/memcheck.h" + UBImportCFF::UBImportCFF(QObject *parent) : UBImportAdaptor(parent) { diff --git a/src/adaptors/UBSvgSubsetAdaptor.cpp b/src/adaptors/UBSvgSubsetAdaptor.cpp index 80917eab..09c1fb8d 100644 --- a/src/adaptors/UBSvgSubsetAdaptor.cpp +++ b/src/adaptors/UBSvgSubsetAdaptor.cpp @@ -471,7 +471,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() { if (annotationGroup) { - annotationGroup->addPolygon(polygonItem); polygonItem->setStroke(annotationGroup); } @@ -492,7 +491,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() { if (annotationGroup) { - annotationGroup->addPolygon(polygonItem); polygonItem->setStroke(annotationGroup); } diff --git a/src/adaptors/UBWebPublisher.cpp b/src/adaptors/UBWebPublisher.cpp index 092d597e..d4505c20 100644 --- a/src/adaptors/UBWebPublisher.cpp +++ b/src/adaptors/UBWebPublisher.cpp @@ -19,10 +19,10 @@ #include "adaptors/publishing/UBDocumentPublisher.h" -#include "core/memcheck.h" - #include "transition/UniboardSankoreTransition.h" +#include "core/memcheck.h" + UBWebPublisher::UBWebPublisher(QObject *parent) : UBExportAdaptor(parent) { diff --git a/src/adaptors/publishing/UBDocumentPublisher.cpp b/src/adaptors/publishing/UBDocumentPublisher.cpp index f04ff140..261f563b 100644 --- a/src/adaptors/publishing/UBDocumentPublisher.cpp +++ b/src/adaptors/publishing/UBDocumentPublisher.cpp @@ -43,9 +43,10 @@ #include "UBSvgSubsetRasterizer.h" -#include "core/memcheck.h" #include "../../core/UBApplication.h" +#include "core/memcheck.h" + UBDocumentPublisher::UBDocumentPublisher(UBDocumentProxy* pDocument, QObject *parent) : QObject(parent) diff --git a/src/board/UBDrawingController.cpp b/src/board/UBDrawingController.cpp index d39dbd48..07d917d3 100644 --- a/src/board/UBDrawingController.cpp +++ b/src/board/UBDrawingController.cpp @@ -33,6 +33,13 @@ UBDrawingController* UBDrawingController::drawingController() return sDrawingController; } +void UBDrawingController::destroy() +{ + if(sDrawingController) + delete sDrawingController; + sDrawingController = NULL; +} + UBDrawingController::UBDrawingController(QObject * parent) : QObject(parent) , mActiveRuler(NULL) diff --git a/src/board/UBDrawingController.h b/src/board/UBDrawingController.h index 2f6e8f3e..a451e972 100644 --- a/src/board/UBDrawingController.h +++ b/src/board/UBDrawingController.h @@ -33,6 +33,7 @@ class UBDrawingController : public QObject public: static UBDrawingController* drawingController(); + static void destroy(); int stylusTool(); int latestDrawingTool(); diff --git a/src/board/UBLibraryController.cpp b/src/board/UBLibraryController.cpp index b1e00bd2..1326b458 100644 --- a/src/board/UBLibraryController.cpp +++ b/src/board/UBLibraryController.cpp @@ -476,7 +476,9 @@ QList UBLibraryController::getContent(UBLibElement *element) UBLibraryController::~UBLibraryController() { cleanElementsList(); - //NOOP + + qDeleteAll(mInternalLibElements); + mInternalLibElements.clear(); } void UBLibraryController::setItemAsBackground(UBLibElement* image) @@ -778,6 +780,7 @@ UBChainedLibElement::~UBChainedLibElement() delete mpNextElem; mpNextElem = NULL; } + delete mpElem; } void UBChainedLibElement::setNextElement(UBChainedLibElement *nextElem) diff --git a/src/board/UBLibraryController.h b/src/board/UBLibraryController.h index bb39e610..c2055196 100644 --- a/src/board/UBLibraryController.h +++ b/src/board/UBLibraryController.h @@ -43,7 +43,7 @@ public: UBLibElement(); UBLibElement(eUBLibElementType type, const QUrl& path, const QString& name); UBLibElement(UBLibElement* element); - ~UBLibElement(); + virtual ~UBLibElement(); static UBLibElement* trashElement(); @@ -79,7 +79,7 @@ class UBChainedLibElement { public: UBChainedLibElement(UBLibElement* pElem, UBChainedLibElement* pNextElem=NULL); - ~UBChainedLibElement(); + virtual ~UBChainedLibElement(); UBChainedLibElement* nextElement(){return mpNextElem;} UBChainedLibElement* lastElement(); diff --git a/src/core/UBApplication.cpp b/src/core/UBApplication.cpp index 53bbebca..7b91387e 100644 --- a/src/core/UBApplication.cpp +++ b/src/core/UBApplication.cpp @@ -53,6 +53,9 @@ #include "ui_mainWindow.h" +#include "frameworks/UBCryptoUtils.h" +#include "tools/UBToolsManager.h" + #include "core/memcheck.h" QPointer UBApplication::undoStack; @@ -182,21 +185,26 @@ UBApplication::~UBApplication() UBFileSystemUtils::deleteAllTempDirCreatedDuringSession(); -// delete mainWindow; + delete mainWindow; mainWindow = 0; -// delete staticMemoryCleaner; - staticMemoryCleaner = 0; - - delete mUniboardSankoreTransition; mUniboardSankoreTransition = 0; - if (mPreferencesController) - { - delete mPreferencesController; - mPreferencesController = 0; - } + UBPersistenceManager::destroy(); + + UBDownloadManager::destroy(); + + UBDrawingController::destroy(); + + UBSettings::destroy(); + + UBCryptoUtils::destroy(); + + UBToolsManager::destroy(); + + delete staticMemoryCleaner; + staticMemoryCleaner = 0; } int UBApplication::exec(const QString& pFileToImport) diff --git a/src/core/UBDocumentManager.cpp b/src/core/UBDocumentManager.cpp index 331c2475..f39a242b 100644 --- a/src/core/UBDocumentManager.cpp +++ b/src/core/UBDocumentManager.cpp @@ -37,9 +37,10 @@ #include "UBSettings.h" #include "UBPersistenceManager.h" -#include "core/memcheck.h" #include "../adaptors/UBExportWeb.h" +#include "core/memcheck.h" + UBDocumentManager* UBDocumentManager::sDocumentManager = 0; UBDocumentManager* UBDocumentManager::documentManager() diff --git a/src/core/UBDownloadManager.cpp b/src/core/UBDownloadManager.cpp index 982a1cd2..4b867a33 100644 --- a/src/core/UBDownloadManager.cpp +++ b/src/core/UBDownloadManager.cpp @@ -18,6 +18,8 @@ #include "board/UBBoardController.h" #include "board/UBBoardPaletteManager.h" +#include "core/memcheck.h" + /** The unique instance of the download manager */ static UBDownloadManager* pInstance = NULL; @@ -55,6 +57,15 @@ UBDownloadManager* UBDownloadManager::downloadManager() return pInstance; } +void UBDownloadManager::destroy() +{ + if(pInstance) + { + delete pInstance; + } + pInstance = NULL; +} + /** * \brief Add a file to the download list * @param desc as the given file description diff --git a/src/core/UBDownloadManager.h b/src/core/UBDownloadManager.h index 4b5ea49c..22d94fc7 100644 --- a/src/core/UBDownloadManager.h +++ b/src/core/UBDownloadManager.h @@ -63,15 +63,14 @@ class UBDownloadManager : public QObject { Q_OBJECT public: - UBDownloadManager(QObject* parent=0, const char* name="UBDownloadManager"); - ~UBDownloadManager(); - static UBDownloadManager* downloadManager(); void addFileToDownload(sDownloadFileDesc desc); QVector currentDownloads(); QVector pendingDownloads(); void cancelDownloads(); + static void destroy(); + signals: void fileAddedToDownload(); void downloadUpdated(int id, qint64 crnt, qint64 total); @@ -89,6 +88,9 @@ private slots: void onDownloadError(int id); private: + UBDownloadManager(QObject* parent=0, const char* name="UBDownloadManager"); + ~UBDownloadManager(); + void init(); void updateDownloadOrder(); void updateFileCurrentSize(int id, qint64 received=-1, qint64 total=-1); diff --git a/src/core/UBDownloadThread.cpp b/src/core/UBDownloadThread.cpp index 08a57906..18fc00f7 100644 --- a/src/core/UBDownloadThread.cpp +++ b/src/core/UBDownloadThread.cpp @@ -20,6 +20,8 @@ #include "UBDownloadThread.h" +#include "core/memcheck.h" + /** * \brief Constructor * @param parent as the parent object diff --git a/src/core/UBPersistenceManager.cpp b/src/core/UBPersistenceManager.cpp index 46f0cb67..33b12078 100644 --- a/src/core/UBPersistenceManager.cpp +++ b/src/core/UBPersistenceManager.cpp @@ -68,6 +68,13 @@ UBPersistenceManager* UBPersistenceManager::persistenceManager() return sSingleton; } +void UBPersistenceManager::destroy() +{ + if (sSingleton) + delete sSingleton; + sSingleton = NULL; +} + UBPersistenceManager::~UBPersistenceManager() { foreach(QPointer proxyGuard, documentProxies) diff --git a/src/core/UBPersistenceManager.h b/src/core/UBPersistenceManager.h index 98a296f6..a0f60d44 100644 --- a/src/core/UBPersistenceManager.h +++ b/src/core/UBPersistenceManager.h @@ -58,6 +58,7 @@ class UBPersistenceManager : public QObject static const QString widgetDirectory; static UBPersistenceManager* persistenceManager(); + static void destroy(); virtual UBDocumentProxy* createDocument(const QString& pGroupName = "", const QString& pName = ""); virtual UBDocumentProxy* createDocumentFromDir(const QString& pDocumentDirectory); diff --git a/src/core/UBSettings.cpp b/src/core/UBSettings.cpp index 54631f21..53d522b2 100644 --- a/src/core/UBSettings.cpp +++ b/src/core/UBSettings.cpp @@ -97,6 +97,23 @@ QString UBSettings::appPingMessage = "__uniboard_ping"; QString UBSettings::defaultDocumentGroupName; QString UBSettings::documentTrashGroupName; +UBSettings* UBSettings::settings() +{ + if (!sSingleton) + sSingleton = new UBSettings(qApp); + return sSingleton; +} + +void UBSettings::destroy() +{ + if (sSingleton) + delete sSingleton; + sSingleton = NULL; +} + + + + QSettings* UBSettings::getAppSettings() { if (!UBSettings::sAppSettings) diff --git a/src/core/UBSettings.h b/src/core/UBSettings.h index f1e1a938..8bd9f136 100644 --- a/src/core/UBSettings.h +++ b/src/core/UBSettings.h @@ -22,13 +22,8 @@ class UBSettings : public QObject public: - static UBSettings* settings() - { - if (!sSingleton) - sSingleton = new UBSettings(qApp); - - return sSingleton; - } + static UBSettings* settings(); + static void destroy(); private: diff --git a/src/core/main.cpp b/src/core/main.cpp index eb94bd60..795d2417 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -21,6 +21,8 @@ #include "UBApplication.h" #include "UBSettings.h" +/* Uncomment this for memory leaks detection */ +/* #if defined(WIN32) && defined(_DEBUG) #define _CRTDBG_MAP_ALLOC #include @@ -28,7 +30,7 @@ #define DEBUG_NEW new( _NORMAL_BLOCK, __FILE__, __LINE__ ) #define new DEBUG_NEW #endif - +*/ void ub_message_output(QtMsgType type, const char *msg) { // We must temporarily remove the handler to avoid the infinite recursion of diff --git a/src/domain/UBGraphicsItemDelegate.cpp b/src/domain/UBGraphicsItemDelegate.cpp index 1468ff8c..ff8c38ed 100644 --- a/src/domain/UBGraphicsItemDelegate.cpp +++ b/src/domain/UBGraphicsItemDelegate.cpp @@ -100,6 +100,7 @@ void UBGraphicsItemDelegate::init() UBGraphicsItemDelegate::~UBGraphicsItemDelegate() { + qDeleteAll(mButtons); // do not release mMimeData. // the mMimeData is owned by QDrag since the setMimeData call as specified in the documentation } diff --git a/src/domain/UBGraphicsPolygonItem.cpp b/src/domain/UBGraphicsPolygonItem.cpp index 1e6eb4b3..c8153ca4 100644 --- a/src/domain/UBGraphicsPolygonItem.cpp +++ b/src/domain/UBGraphicsPolygonItem.cpp @@ -53,25 +53,29 @@ UBGraphicsPolygonItem::UBGraphicsPolygonItem (const QLineF& pLine, qreal pWidth) // NOOP } - -UBGraphicsPolygonItem::~UBGraphicsPolygonItem() +void UBGraphicsPolygonItem::clearStroke() { if (mStroke!=NULL) { - QList pp = mStroke->polygons(); - int n = pp.indexOf(this); - if (n>=0) - pp.removeAt(n); - if (pp.empty()) - delete mStroke; + mStroke->remove(this); + if (mStroke->polygons().empty()) + delete mStroke; + mStroke = NULL; } } +UBGraphicsPolygonItem::~UBGraphicsPolygonItem() +{ + clearStroke(); +} + void UBGraphicsPolygonItem::setStroke(UBGraphicsStroke* stroke) { - mStroke = stroke; + clearStroke(); + mStroke = stroke; + mStroke->addPolygon(this); } UBGraphicsStroke* UBGraphicsPolygonItem::stroke() const diff --git a/src/domain/UBGraphicsPolygonItem.h b/src/domain/UBGraphicsPolygonItem.h index 2dccd84d..66498ef2 100644 --- a/src/domain/UBGraphicsPolygonItem.h +++ b/src/domain/UBGraphicsPolygonItem.h @@ -116,6 +116,9 @@ class UBGraphicsPolygonItem : public QGraphicsPolygonItem, public UBItem private: + + void clearStroke(); + bool mHasAlpha; QLineF mOriginalLine; diff --git a/src/domain/UBGraphicsScene.cpp b/src/domain/UBGraphicsScene.cpp index b46796f7..99bea72f 100644 --- a/src/domain/UBGraphicsScene.cpp +++ b/src/domain/UBGraphicsScene.cpp @@ -141,8 +141,11 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent) UBGraphicsScene::~UBGraphicsScene() { - // NOOP DisposeMagnifierQWidgets(); + + if (mCurrentStroke) + if (mCurrentStroke->polygons().empty()) + delete mCurrentStroke; } void UBGraphicsScene::selectionChangedProcessing() @@ -190,6 +193,12 @@ bool UBGraphicsScene::inputDevicePress(const QPointF& scenePos, const qreal& pre if (UBDrawingController::drawingController()->isDrawingTool()) { qreal width = 0; + + // delete current stroke, if not assigned to any polygon + if (mCurrentStroke) + if (mCurrentStroke->polygons().empty()) + delete mCurrentStroke; + mCurrentStroke = new UBGraphicsStroke(); if (currentTool != UBStylusTool::Line) @@ -344,7 +353,12 @@ bool UBGraphicsScene::inputDeviceRelease() UBDrawingController *dc = UBDrawingController::drawingController(); if (dc->isDrawingTool()) { - mCurrentStroke = 0; + if (mCurrentStroke) + { + if (mCurrentStroke->polygons().empty()) + delete mCurrentStroke; + mCurrentStroke = 0; + } } if (mRemovedItems.size() > 0 || mAddedItems.size() > 0) @@ -503,7 +517,6 @@ void UBGraphicsScene::drawLineTo(const QPointF &pEndPoint, const qreal &pWidth, if (mCurrentStroke) { - mCurrentStroke->addPolygon(polygonItem); polygonItem->setStroke(mCurrentStroke); } diff --git a/src/domain/UBGraphicsStroke.cpp b/src/domain/UBGraphicsStroke.cpp index a54fdc52..ea4aefd1 100644 --- a/src/domain/UBGraphicsStroke.cpp +++ b/src/domain/UBGraphicsStroke.cpp @@ -33,9 +33,16 @@ UBGraphicsStroke::~UBGraphicsStroke() void UBGraphicsStroke::addPolygon(UBGraphicsPolygonItem* pol) { + remove(pol); mPolygons << pol; } +void UBGraphicsStroke::remove(UBGraphicsPolygonItem* polygonItem) +{ + int n = mPolygons.indexOf(polygonItem); + if (n>=0) + mPolygons.removeAt(n); +} QList UBGraphicsStroke::polygons() const { diff --git a/src/domain/UBGraphicsStroke.h b/src/domain/UBGraphicsStroke.h index 1595599a..32e24574 100644 --- a/src/domain/UBGraphicsStroke.h +++ b/src/domain/UBGraphicsStroke.h @@ -25,20 +25,25 @@ class UBGraphicsPolygonItem; class UBGraphicsStroke { + friend class UBGraphicsPolygonItem; + public: UBGraphicsStroke(); virtual ~UBGraphicsStroke(); bool hasPressure(); - void addPolygon(UBGraphicsPolygonItem* pol); - QList polygons() const; + void remove(UBGraphicsPolygonItem* polygonItem); + UBGraphicsStroke *deepCopy(); bool hasAlpha() const; + protected: + void addPolygon(UBGraphicsPolygonItem* pol); + private: QList mPolygons; diff --git a/src/frameworks/UBCryptoUtils.cpp b/src/frameworks/UBCryptoUtils.cpp index 0a6831a9..d327510b 100644 --- a/src/frameworks/UBCryptoUtils.cpp +++ b/src/frameworks/UBCryptoUtils.cpp @@ -23,6 +23,21 @@ UBCryptoUtils* UBCryptoUtils::sInstance(0); QString UBCryptoUtils::sAESKey("9ecHaspud9uD9ste5erAchehefrup3echej-caje6&thestawacuk=h#F3jet3aF"); QString UBCryptoUtils::sAESSalt("6f0083e0-a90c-11de-ac21-0002a5d5c51b"); +UBCryptoUtils* UBCryptoUtils::instance() +{ + if(!sInstance) + sInstance = new UBCryptoUtils(UBApplication::staticMemoryCleaner); + + return sInstance; +} + +void UBCryptoUtils::destroy() +{ + if (sInstance) + delete sInstance; + sInstance = NULL; +} + UBCryptoUtils::UBCryptoUtils(QObject * pParent) : QObject(pParent) diff --git a/src/frameworks/UBCryptoUtils.h b/src/frameworks/UBCryptoUtils.h index 3e1a22eb..b5b1141c 100644 --- a/src/frameworks/UBCryptoUtils.h +++ b/src/frameworks/UBCryptoUtils.h @@ -28,13 +28,9 @@ class UBCryptoUtils : public QObject public: - static UBCryptoUtils* instance() - { - if(!sInstance) - sInstance = new UBCryptoUtils(UBApplication::staticMemoryCleaner); + static UBCryptoUtils* instance(); + static void destroy(); - return sInstance; - } QString symetricEncrypt(const QString& clear); QString symetricDecrypt(const QString& encrypted); diff --git a/src/frameworks/UBDesktopServices.h b/src/frameworks/UBDesktopServices.h index 08838c9e..0e7c3dc9 100644 --- a/src/frameworks/UBDesktopServices.h +++ b/src/frameworks/UBDesktopServices.h @@ -19,6 +19,8 @@ #include #include +#include "core/memcheck.h" + // TODO Qt 4.6 #error Delete this UBDesktopServices class, // it was used to work around a bug in Qt 4.4 that was fixed in Qt 4.5 and another that should be fixed // in 4.5.1 diff --git a/src/gui/UBCachePropertiesWidget.cpp b/src/gui/UBCachePropertiesWidget.cpp index 7deb5232..46f9f798 100644 --- a/src/gui/UBCachePropertiesWidget.cpp +++ b/src/gui/UBCachePropertiesWidget.cpp @@ -10,6 +10,8 @@ #include "board/UBBoardController.h" #include "domain/UBGraphicsScene.h" +#include "core/memcheck.h" + static QVector mCaches; UBCachePropertiesWidget::UBCachePropertiesWidget(QWidget *parent, const char *name):UBDockPaletteWidget(parent) diff --git a/src/gui/UBDockPaletteWidget.cpp b/src/gui/UBDockPaletteWidget.cpp index 9cd1197c..16bcb322 100644 --- a/src/gui/UBDockPaletteWidget.cpp +++ b/src/gui/UBDockPaletteWidget.cpp @@ -1,5 +1,7 @@ #include "UBDockPaletteWidget.h" +#include "core/memcheck.h" + UBDockPaletteWidget::UBDockPaletteWidget(QWidget *parent, const char *name):QWidget(parent) { setObjectName(name); diff --git a/src/gui/UBDownloadWidget.cpp b/src/gui/UBDownloadWidget.cpp index 1a954a53..22661566 100644 --- a/src/gui/UBDownloadWidget.cpp +++ b/src/gui/UBDownloadWidget.cpp @@ -20,6 +20,8 @@ #include "UBDownloadWidget.h" #include "core/UBApplication.h" +#include "core/memcheck.h" + /** * \brief Constructor * @param parent as the parent widget diff --git a/src/gui/UBLeftPalette.cpp b/src/gui/UBLeftPalette.cpp index c5debaa6..391b0efe 100644 --- a/src/gui/UBLeftPalette.cpp +++ b/src/gui/UBLeftPalette.cpp @@ -15,6 +15,8 @@ #include "UBLeftPalette.h" #include "core/UBSettings.h" +#include "core/memcheck.h" + /** * \brief The constructor */ diff --git a/src/gui/UBLibNavigatorWidget.cpp b/src/gui/UBLibNavigatorWidget.cpp index f65c97f8..ba96856b 100644 --- a/src/gui/UBLibNavigatorWidget.cpp +++ b/src/gui/UBLibNavigatorWidget.cpp @@ -143,8 +143,9 @@ void UBLibNavigatorWidget::removeNextChainedElements(UBChainedLibElement *fromEl { if(NULL != fromElem->nextElement()) { - removeNextChainedElements(fromElem->nextElement()); - delete fromElem->nextElement()->element(); + //removeNextChainedElements(fromElem->nextElement()); + //delete fromElem->nextElement()->element(); + //delete fromElem->nextElement(); delete fromElem->nextElement(); fromElem->setNextElement(NULL); } diff --git a/src/gui/UBLibPathViewer.cpp b/src/gui/UBLibPathViewer.cpp index d66cb4be..2ebe046a 100644 --- a/src/gui/UBLibPathViewer.cpp +++ b/src/gui/UBLibPathViewer.cpp @@ -80,16 +80,16 @@ UBLibPathViewer::~UBLibPathViewer() delete mpElems; mpElems = NULL; } - if(NULL != mpElemsBackup) - { - delete mpElemsBackup; - mpElemsBackup = NULL; - } - if(NULL != mpLayout) - { - delete mpLayout; - mpLayout = NULL; - } + //if(NULL != mpElemsBackup) + //{ + // delete mpElemsBackup; + // mpElemsBackup = NULL; + //} + //if(NULL != mpLayout) + //{ + // delete mpLayout; + // mpLayout = NULL; + //} if(NULL != mpScene) { delete mpScene; diff --git a/src/gui/UBLibWebView.cpp b/src/gui/UBLibWebView.cpp index 63ca4139..ebea433b 100644 --- a/src/gui/UBLibWebView.cpp +++ b/src/gui/UBLibWebView.cpp @@ -4,6 +4,8 @@ #include "UBLibWebView.h" +#include "core/memcheck.h" + UBLibWebView::UBLibWebView(QWidget* parent, const char* name):QWidget(parent) , mpView(NULL) , mpWebSettings(NULL) diff --git a/src/gui/UBLibWidget.cpp b/src/gui/UBLibWidget.cpp index aa2d996a..8e23613d 100644 --- a/src/gui/UBLibWidget.cpp +++ b/src/gui/UBLibWidget.cpp @@ -15,9 +15,10 @@ #include #include "UBLibWidget.h" -#include "core/memcheck.h" #include "core/UBApplication.h" +#include "core/memcheck.h" + /** * \brief Constructor * @param parent as the parent widget diff --git a/src/gui/UBLibraryWidget.cpp b/src/gui/UBLibraryWidget.cpp index 05fe0b36..6da8f76e 100644 --- a/src/gui/UBLibraryWidget.cpp +++ b/src/gui/UBLibraryWidget.cpp @@ -24,11 +24,12 @@ #include "board/UBBoardController.h" #include "board/UBLibraryController.h" -#include "core/memcheck.h" #include "core/UBDownloadManager.h" #include "frameworks/UBFileSystemUtils.h" +#include "core/memcheck.h" + /** * \brief Constructor * @param parent as the parent widget @@ -55,12 +56,6 @@ UBLibraryWidget::~UBLibraryWidget() delete mLibraryController; mLibraryController = NULL; } - -// if(NULL != chainedElements) -// { -// delete chainedElements; -// chainedElements = NULL; -// } if(NULL != mpCrntDir) { delete mpCrntDir; diff --git a/src/gui/UBMagnifer.cpp b/src/gui/UBMagnifer.cpp index a6bbe28b..c1a779a7 100644 --- a/src/gui/UBMagnifer.cpp +++ b/src/gui/UBMagnifer.cpp @@ -20,6 +20,8 @@ #include "board/UBBoardController.h" #include "domain/UBGraphicsScene.h" +#include "core/memcheck.h" + UBMagnifier::UBMagnifier(QWidget *parent, bool isInteractive) : QWidget(parent, parent ? Qt::Widget : Qt::Tool | (Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint)) diff --git a/src/gui/UBRightPalette.cpp b/src/gui/UBRightPalette.cpp index ee54b4e7..3c36658d 100644 --- a/src/gui/UBRightPalette.cpp +++ b/src/gui/UBRightPalette.cpp @@ -17,6 +17,8 @@ #include "UBRightPalette.h" +#include "core/memcheck.h" + /** * \brief The constructor */ diff --git a/src/gui/UBRubberBand.cpp b/src/gui/UBRubberBand.cpp index 6f2d5cb5..3d33fe18 100644 --- a/src/gui/UBRubberBand.cpp +++ b/src/gui/UBRubberBand.cpp @@ -26,17 +26,20 @@ UBRubberBand::UBRubberBand(Shape s, QWidget * p) : QRubberBand(s, p) { - QStyle* rubberBandStyle = QRubberBand::style(); + customStyle = NULL; #ifdef Q_WS_WIN - rubberBandStyle = new QWindowsXPStyle(); + customStyle = new QWindowsXPStyle(); #elif defined(Q_WS_MAC) - rubberBandStyle = new QMacStyle(); + customStyle = new QMacStyle(); #endif - QRubberBand::setStyle(rubberBandStyle); + + if (customStyle) + QRubberBand::setStyle(customStyle); } UBRubberBand::~UBRubberBand() { - // NOOP + if (customStyle) + delete customStyle; } diff --git a/src/gui/UBRubberBand.h b/src/gui/UBRubberBand.h index 769e9877..5b251c15 100644 --- a/src/gui/UBRubberBand.h +++ b/src/gui/UBRubberBand.h @@ -25,6 +25,8 @@ class UBRubberBand : public QRubberBand public: UBRubberBand(Shape s, QWidget * p = 0); virtual ~UBRubberBand(); + private: + QStyle* customStyle; }; #endif /* UBRUBBERBAND_H_ */ diff --git a/src/gui/UBTeacherBarWidget.cpp b/src/gui/UBTeacherBarWidget.cpp index d5eb6688..77b2ef58 100644 --- a/src/gui/UBTeacherBarWidget.cpp +++ b/src/gui/UBTeacherBarWidget.cpp @@ -9,6 +9,8 @@ #include "board/UBBoardController.h" #include "board/UBBoardPaletteManager.h" +#include "core/memcheck.h" + UBTeacherBarWidget::UBTeacherBarWidget(QWidget *parent, const char *name):UBDockPaletteWidget(parent) , mpLayout(NULL) , mpTitleLayout(NULL) diff --git a/src/gui/UBThumbnailWidget.cpp b/src/gui/UBThumbnailWidget.cpp index 227e3fac..c4a8ab5e 100644 --- a/src/gui/UBThumbnailWidget.cpp +++ b/src/gui/UBThumbnailWidget.cpp @@ -21,11 +21,11 @@ #include "core/UBSettings.h" #include "core/UBApplication.h" -#include "core/memcheck.h" - #include "document/UBDocumentProxy.h" #include "document/UBDocumentController.h" +#include "core/memcheck.h" + UBThumbnailWidget::UBThumbnailWidget(QWidget* parent) : QGraphicsView(parent) , mThumbnailWidth(UBSettings::defaultThumbnailWidth) diff --git a/src/pdf-merger/ASCII85Decode.cpp b/src/pdf-merger/ASCII85Decode.cpp index 08fff483..1a3d3ac9 100644 --- a/src/pdf-merger/ASCII85Decode.cpp +++ b/src/pdf-merger/ASCII85Decode.cpp @@ -15,6 +15,9 @@ #include #include "ASCII85Decode.h" + +#include "core/memcheck.h" + using namespace merge_lib; static const unsigned long pow85[] = { 85*85*85*85, 85*85*85, 85*85, 85, 1 diff --git a/src/pdf-merger/ASCIIHexDecode.cpp b/src/pdf-merger/ASCIIHexDecode.cpp index 9a45461c..91aa0728 100644 --- a/src/pdf-merger/ASCIIHexDecode.cpp +++ b/src/pdf-merger/ASCIIHexDecode.cpp @@ -17,6 +17,8 @@ #include #include "Utils.h" +#include "core/memcheck.h" + using namespace merge_lib; const std::string WHITESPACES(" \t\f\v\n\r"); diff --git a/src/pdf-merger/AnnotsHandler.cpp b/src/pdf-merger/AnnotsHandler.cpp index 1fca74fb..1b9204bd 100644 --- a/src/pdf-merger/AnnotsHandler.cpp +++ b/src/pdf-merger/AnnotsHandler.cpp @@ -14,6 +14,8 @@ */ #include "AnnotsHandler.h" +#include "core/memcheck.h" + using namespace merge_lib; void AnnotsHandler::_processObjectContent(unsigned int startOfPageElement) { diff --git a/src/pdf-merger/ContentHandler.cpp b/src/pdf-merger/ContentHandler.cpp index fd451a04..0e298b39 100644 --- a/src/pdf-merger/ContentHandler.cpp +++ b/src/pdf-merger/ContentHandler.cpp @@ -21,6 +21,8 @@ #include #include +#include "core/memcheck.h" + using namespace merge_lib; using namespace std; //concatenate stream of all objects which contain Content of Page diff --git a/src/pdf-merger/Document.cpp b/src/pdf-merger/Document.cpp index bfed21e3..ac3c0cb8 100644 --- a/src/pdf-merger/Document.cpp +++ b/src/pdf-merger/Document.cpp @@ -23,6 +23,8 @@ #include #include +#include "core/memcheck.h" + using namespace merge_lib; const std::string firstObj("%PDF-1.4\n1 0 obj\n<<\n/Title ()/Creator ()/Producer (Qt 4.5.0 (C) 1992-2009 Nokia Corporation and/or its subsidiary(-ies))/CreationDate (D:20090424120829)\n>>\nendobj\n"); const std::string zeroStr("0000000000"); diff --git a/src/pdf-merger/Filter.cpp b/src/pdf-merger/Filter.cpp index 6660e259..cc2c9132 100644 --- a/src/pdf-merger/Filter.cpp +++ b/src/pdf-merger/Filter.cpp @@ -24,6 +24,8 @@ #include "JBIG2Decode.h" #include "DCTDecode.h" +#include "core/memcheck.h" + using namespace merge_lib; std::map Filter::_allDecoders; diff --git a/src/pdf-merger/FilterPredictor.cpp b/src/pdf-merger/FilterPredictor.cpp index 189aa781..fb372ade 100644 --- a/src/pdf-merger/FilterPredictor.cpp +++ b/src/pdf-merger/FilterPredictor.cpp @@ -21,6 +21,8 @@ #include "Object.h" #include "Parser.h" +#include "core/memcheck.h" + using namespace merge_lib; const std::string FilterPredictor::PREDICTOR_TOKEN = "/Predictor"; diff --git a/src/pdf-merger/FlateDecode.cpp b/src/pdf-merger/FlateDecode.cpp index f2933116..a92322c6 100644 --- a/src/pdf-merger/FlateDecode.cpp +++ b/src/pdf-merger/FlateDecode.cpp @@ -19,6 +19,8 @@ #include "Utils.h" #include +#include "core/memcheck.h" + using namespace merge_lib; #define ZLIB_MEM_DELTA 65535 #define ZLIB_CHECK_ERR(err,msg) \ diff --git a/src/pdf-merger/LZWDecode.cpp b/src/pdf-merger/LZWDecode.cpp index 1d8f1fca..57886ea0 100644 --- a/src/pdf-merger/LZWDecode.cpp +++ b/src/pdf-merger/LZWDecode.cpp @@ -16,6 +16,8 @@ #include "LZWDecode.h" #include "FilterPredictor.h" +#include "core/memcheck.h" + // method performs decoding using namespace merge_lib; diff --git a/src/pdf-merger/Merger.cpp b/src/pdf-merger/Merger.cpp index 1ef60562..bea5e2cd 100644 --- a/src/pdf-merger/Merger.cpp +++ b/src/pdf-merger/Merger.cpp @@ -21,6 +21,8 @@ #include #include +#include "core/memcheck.h" + using namespace merge_lib; Parser Merger::_parser; diff --git a/src/pdf-merger/Object.cpp b/src/pdf-merger/Object.cpp index 5611dd3f..913df012 100644 --- a/src/pdf-merger/Object.cpp +++ b/src/pdf-merger/Object.cpp @@ -19,6 +19,8 @@ #include #include +#include "core/memcheck.h" + using namespace merge_lib; std::string NUMBERANDWHITESPACE(" 0123456789"); diff --git a/src/pdf-merger/OverlayDocumentParser.cpp b/src/pdf-merger/OverlayDocumentParser.cpp index f1b75d0e..379b63cd 100644 --- a/src/pdf-merger/OverlayDocumentParser.cpp +++ b/src/pdf-merger/OverlayDocumentParser.cpp @@ -18,6 +18,8 @@ #include "Exception.h" #include "Object.h" +#include "core/memcheck.h" + using namespace merge_lib; using namespace std; diff --git a/src/pdf-merger/Page.cpp b/src/pdf-merger/Page.cpp index 0ba233d6..58875808 100644 --- a/src/pdf-merger/Page.cpp +++ b/src/pdf-merger/Page.cpp @@ -32,6 +32,8 @@ #include #include "Parser.h" +#include "core/memcheck.h" + using namespace merge_lib; diff --git a/src/pdf-merger/PageElementHandler.cpp b/src/pdf-merger/PageElementHandler.cpp index e9c6cdd0..febf8f9d 100644 --- a/src/pdf-merger/PageElementHandler.cpp +++ b/src/pdf-merger/PageElementHandler.cpp @@ -14,6 +14,8 @@ */ #include "PageElementHandler.h" +#include "core/memcheck.h" + using namespace merge_lib; std::set PageElementHandler::_allPageFields; diff --git a/src/pdf-merger/Parser.cpp b/src/pdf-merger/Parser.cpp index 814f6dfa..9841342c 100644 --- a/src/pdf-merger/Parser.cpp +++ b/src/pdf-merger/Parser.cpp @@ -23,6 +23,8 @@ #include "Exception.h" #include "Utils.h" +#include "core/memcheck.h" + using namespace merge_lib; using namespace std; diff --git a/src/pdf-merger/Rectangle.cpp b/src/pdf-merger/Rectangle.cpp index fa1d8d93..dffa32d4 100644 --- a/src/pdf-merger/Rectangle.cpp +++ b/src/pdf-merger/Rectangle.cpp @@ -19,6 +19,8 @@ #include +#include "core/memcheck.h" + using namespace merge_lib; Rectangle::Rectangle(const char * rectangleName): diff --git a/src/pdf-merger/RemoveHimselfHandler.cpp b/src/pdf-merger/RemoveHimselfHandler.cpp index 30e9d36c..ae808f96 100644 --- a/src/pdf-merger/RemoveHimselfHandler.cpp +++ b/src/pdf-merger/RemoveHimselfHandler.cpp @@ -14,6 +14,8 @@ */ #include "RemoveHimSelfHandler.h" +#include "core/memcheck.h" + using namespace merge_lib; void RemoveHimselfHandler::_changeObjectContent(unsigned int startOfPageElement) diff --git a/src/pdf-merger/RunLengthDecode.cpp b/src/pdf-merger/RunLengthDecode.cpp index eeb0ad36..33014041 100644 --- a/src/pdf-merger/RunLengthDecode.cpp +++ b/src/pdf-merger/RunLengthDecode.cpp @@ -14,6 +14,8 @@ */ #include "RunLengthDecode.h" +#include "core/memcheck.h" + using namespace merge_lib; /* The encoded data is a sequence of diff --git a/src/pdf-merger/Utils.cpp b/src/pdf-merger/Utils.cpp index 5f79c6ba..74b056a4 100644 --- a/src/pdf-merger/Utils.cpp +++ b/src/pdf-merger/Utils.cpp @@ -21,6 +21,8 @@ #include #include +#include "core/memcheck.h" + using namespace merge_lib; int Utils::stringToInt(const std::string & str) //throw ConvertException diff --git a/src/podcast/UBAbstractVideoEncoder.cpp b/src/podcast/UBAbstractVideoEncoder.cpp index f8e26362..2d6fc78c 100644 --- a/src/podcast/UBAbstractVideoEncoder.cpp +++ b/src/podcast/UBAbstractVideoEncoder.cpp @@ -15,6 +15,8 @@ #include "UBAbstractVideoEncoder.h" +#include "core/memcheck.h" + UBAbstractVideoEncoder::UBAbstractVideoEncoder(QObject *pParent) : QObject(pParent) , mFramesPerSecond(10) diff --git a/src/podcast/UBPodcastController.cpp b/src/podcast/UBPodcastController.cpp index 959e794c..9b6e03d5 100644 --- a/src/podcast/UBPodcastController.cpp +++ b/src/podcast/UBPodcastController.cpp @@ -53,6 +53,7 @@ #include "quicktime/UBAudioQueueRecorder.h" #endif +#include "core/memcheck.h" UBPodcastController* UBPodcastController::sInstance = 0; diff --git a/src/podcast/UBPodcastRecordingPalette.cpp b/src/podcast/UBPodcastRecordingPalette.cpp index fb0662c7..aae016c1 100644 --- a/src/podcast/UBPodcastRecordingPalette.cpp +++ b/src/podcast/UBPodcastRecordingPalette.cpp @@ -25,6 +25,7 @@ #include "gui/UBMainWindow.h" +#include "core/memcheck.h" UBPodcastRecordingPalette::UBPodcastRecordingPalette(QWidget *parent) : UBActionPalette(Qt::Horizontal, parent) diff --git a/src/podcast/intranet/UBIntranetPodcastPublisher.cpp b/src/podcast/intranet/UBIntranetPodcastPublisher.cpp index ab8ed711..2a44a1d2 100644 --- a/src/podcast/intranet/UBIntranetPodcastPublisher.cpp +++ b/src/podcast/intranet/UBIntranetPodcastPublisher.cpp @@ -28,6 +28,8 @@ #include "gui/UBMainWindow.h" +#include "core/memcheck.h" + UBIntranetPodcastPublisher::UBIntranetPodcastPublisher(QObject* pParent) : QObject(pParent) diff --git a/src/podcast/quicktime/UBAudioQueueRecorder.cpp b/src/podcast/quicktime/UBAudioQueueRecorder.cpp index dda9057c..388a9a7f 100644 --- a/src/podcast/quicktime/UBAudioQueueRecorder.cpp +++ b/src/podcast/quicktime/UBAudioQueueRecorder.cpp @@ -15,6 +15,7 @@ #include "UBAudioQueueRecorder.h" +#include "core/memcheck.h" AudioStreamBasicDescription UBAudioQueueRecorder::sAudioFormat; diff --git a/src/podcast/quicktime/UBQuickTimeFile.cpp b/src/podcast/quicktime/UBQuickTimeFile.cpp index 2947df66..0feae38a 100644 --- a/src/podcast/quicktime/UBQuickTimeFile.cpp +++ b/src/podcast/quicktime/UBQuickTimeFile.cpp @@ -22,6 +22,8 @@ #include "UBAudioQueueRecorder.h" #include +#include "core/memcheck.h" + QQueue UBQuickTimeFile::frameQueue; QMutex UBQuickTimeFile::frameQueueMutex; QWaitCondition UBQuickTimeFile::frameBufferNotEmpty; diff --git a/src/podcast/quicktime/UBQuickTimeVideoEncoder.cpp b/src/podcast/quicktime/UBQuickTimeVideoEncoder.cpp index 6983151d..f188ab80 100644 --- a/src/podcast/quicktime/UBQuickTimeVideoEncoder.cpp +++ b/src/podcast/quicktime/UBQuickTimeVideoEncoder.cpp @@ -28,6 +28,7 @@ #include "UBQuickTimeFile.h" +#include "core/memcheck.h" UBQuickTimeVideoEncoder::UBQuickTimeVideoEncoder(QObject* pParent) : UBAbstractVideoEncoder(pParent) diff --git a/src/podcast/windowsmedia/UBWaveRecorder.cpp b/src/podcast/windowsmedia/UBWaveRecorder.cpp index b36074b8..848239d6 100644 --- a/src/podcast/windowsmedia/UBWaveRecorder.cpp +++ b/src/podcast/windowsmedia/UBWaveRecorder.cpp @@ -17,6 +17,8 @@ #include "Mmsystem.h" +#include "core/memcheck.h" + UBWaveRecorder::UBWaveRecorder(QObject * pParent) : QObject(pParent) , mIsRecording(false) diff --git a/src/podcast/windowsmedia/UBWindowsMediaFile.cpp b/src/podcast/windowsmedia/UBWindowsMediaFile.cpp index 79adfa80..5e681066 100644 --- a/src/podcast/windowsmedia/UBWindowsMediaFile.cpp +++ b/src/podcast/windowsmedia/UBWindowsMediaFile.cpp @@ -19,6 +19,8 @@ #include "core/UBApplication.h" +#include "core/memcheck.h" + UBWindowsMediaFile::UBWindowsMediaFile(QObject * pParent) : QObject(pParent) , mWMhDC(0) diff --git a/src/podcast/windowsmedia/UBWindowsMediaVideoEncoder.cpp b/src/podcast/windowsmedia/UBWindowsMediaVideoEncoder.cpp index f1322b06..bc2ee2fe 100644 --- a/src/podcast/windowsmedia/UBWindowsMediaVideoEncoder.cpp +++ b/src/podcast/windowsmedia/UBWindowsMediaVideoEncoder.cpp @@ -24,6 +24,7 @@ #include "UBWindowsMediaFile.h" +#include "core/memcheck.h" UBWindowsMediaVideoEncoder::UBWindowsMediaVideoEncoder(QObject* pParent) : UBAbstractVideoEncoder(pParent) diff --git a/src/podcast/youtube/UBYouTubePublisher.cpp b/src/podcast/youtube/UBYouTubePublisher.cpp index b2825733..5cd44662 100644 --- a/src/podcast/youtube/UBYouTubePublisher.cpp +++ b/src/podcast/youtube/UBYouTubePublisher.cpp @@ -29,6 +29,8 @@ #include "network/UBNetworkAccessManager.h" #include "network/UBServerXMLHttpRequest.h" +#include "core/memcheck.h" + // API key linked to account dev.mnemis@gmail.com const QString UBYouTubePublisher::sYouTubeDeveloperKey("AI39si62ga82stA4YBr5JjkfuRsFT-QyC4UYsFn7yYQFMe_dzg8xOc0r91BOhxSEhEr0gdWJGNnDsYbv9wvpyROd2Yre-6Zh7g"); diff --git a/src/softwareupdate/UBRssHandler.cpp b/src/softwareupdate/UBRssHandler.cpp index fb7584d4..5097600a 100644 --- a/src/softwareupdate/UBRssHandler.cpp +++ b/src/softwareupdate/UBRssHandler.cpp @@ -18,6 +18,8 @@ #include "UBRssHandler.h" #include "UBSoftwareUpdate.h" +#include "core/memcheck.h" + const QString UBRssHandler::sRssItemElementName = "item"; const QString UBRssHandler::sRssLinkElementName = "link"; const QString UBRssHandler::sUniboardVersionElementName = "ub:version"; // TODO UB 4.x map properly ub namespace diff --git a/src/softwareupdate/UBSoftwareUpdate.cpp b/src/softwareupdate/UBSoftwareUpdate.cpp index 247a565a..84a3e450 100644 --- a/src/softwareupdate/UBSoftwareUpdate.cpp +++ b/src/softwareupdate/UBSoftwareUpdate.cpp @@ -17,6 +17,8 @@ #include "UBSoftwareUpdate.h" +#include "core/memcheck.h" + UBSoftwareUpdate::UBSoftwareUpdate() { // NOOP diff --git a/src/tools/UBGraphicsCache.cpp b/src/tools/UBGraphicsCache.cpp index 62e1f0cc..0c5da394 100644 --- a/src/tools/UBGraphicsCache.cpp +++ b/src/tools/UBGraphicsCache.cpp @@ -22,6 +22,7 @@ #include "board/UBBoardView.h" #include "domain/UBGraphicsScene.h" +#include "core/memcheck.h" UBGraphicsCache::UBGraphicsCache():QGraphicsRectItem() , mMaskColor(Qt::black) diff --git a/src/tools/UBToolsManager.cpp b/src/tools/UBToolsManager.cpp index e536bc2c..48cead63 100644 --- a/src/tools/UBToolsManager.cpp +++ b/src/tools/UBToolsManager.cpp @@ -19,6 +19,21 @@ UBToolsManager* UBToolsManager::sManager = 0; +UBToolsManager* UBToolsManager::manager() +{ + if (!sManager) + sManager = new UBToolsManager(UBApplication::staticMemoryCleaner); + return sManager; +} + +void UBToolsManager::destroy() +{ + if (sManager) + delete sManager; + sManager = NULL; +} + + UBToolsManager::UBToolsManager(QObject *parent) : QObject(parent) { diff --git a/src/tools/UBToolsManager.h b/src/tools/UBToolsManager.h index 3ad3ccf1..5474a9e3 100644 --- a/src/tools/UBToolsManager.h +++ b/src/tools/UBToolsManager.h @@ -38,12 +38,8 @@ class UBToolsManager : public QObject }; - static UBToolsManager* manager() - { - if (!sManager) - sManager = new UBToolsManager(UBApplication::staticMemoryCleaner); - return sManager; - } + static UBToolsManager* manager(); + static void destroy(); QList allTools() { diff --git a/src/transition/UniboardSankoreTransition.cpp b/src/transition/UniboardSankoreTransition.cpp index 5e6821c5..26fa1168 100644 --- a/src/transition/UniboardSankoreTransition.cpp +++ b/src/transition/UniboardSankoreTransition.cpp @@ -20,6 +20,8 @@ #include "core/UBApplication.h" #include "core/UBPersistenceManager.h" +#include "core/memcheck.h" + UniboardSankoreTransition::UniboardSankoreTransition(QObject *parent) : QObject(parent) , mTransitionDlg(NULL) diff --git a/src/web/UBRoutedMouseEventWebView.cpp b/src/web/UBRoutedMouseEventWebView.cpp index 46224359..21fc3f14 100644 --- a/src/web/UBRoutedMouseEventWebView.cpp +++ b/src/web/UBRoutedMouseEventWebView.cpp @@ -19,6 +19,8 @@ #include #include +#include "core/memcheck.h" + UBRoutedMouseEventWebView::UBRoutedMouseEventWebView(QWidget * parent) : QWebView(parent) { diff --git a/src/web/UBTrapFlashController.cpp b/src/web/UBTrapFlashController.cpp index bd2c4c06..d93c0a17 100644 --- a/src/web/UBTrapFlashController.cpp +++ b/src/web/UBTrapFlashController.cpp @@ -33,6 +33,7 @@ #include "ui_trapFlash.h" +#include "core/memcheck.h" UBTrapFlashController::UBTrapFlashController(QWidget* parent) : QObject(parent) diff --git a/src/web/UBWebController.cpp b/src/web/UBWebController.cpp index 26ddd181..aef9660b 100644 --- a/src/web/UBWebController.cpp +++ b/src/web/UBWebController.cpp @@ -48,6 +48,7 @@ #include "desktop/UBCustomCaptureWindow.h" #include "board/UBBoardPaletteManager.h" +#include "core/memcheck.h" UBWebController::UBWebController(UBMainWindow* mainWindow) : QObject(mainWindow->centralWidget()) diff --git a/src/web/UBWebKitUtils.cpp b/src/web/UBWebKitUtils.cpp index 594180e7..d4c0f45b 100644 --- a/src/web/UBWebKitUtils.cpp +++ b/src/web/UBWebKitUtils.cpp @@ -15,6 +15,8 @@ #include "UBWebKitUtils.h" +#include "core/memcheck.h" + UBWebKitUtils::UBWebKitUtils() { // NOOP diff --git a/src/web/UBWebPage.cpp b/src/web/UBWebPage.cpp index a87130e2..74dde74f 100644 --- a/src/web/UBWebPage.cpp +++ b/src/web/UBWebPage.cpp @@ -20,6 +20,8 @@ #include "pdf/UBWebPluginPDFWidget.h" +#include "core/memcheck.h" + class UBWebPluginFactory : public QWebPluginFactory { public: diff --git a/src/web/UBWebPluginWidget.cpp b/src/web/UBWebPluginWidget.cpp index bb12910f..a6973d64 100644 --- a/src/web/UBWebPluginWidget.cpp +++ b/src/web/UBWebPluginWidget.cpp @@ -18,6 +18,8 @@ #include "pdf/UBWebPluginPDFWidget.h" #include "frameworks/UBFileSystemUtils.h" +#include "core/memcheck.h" + UBWebPluginWidget::UBWebPluginWidget(const QUrl &url, QWidget *parent) : QWidget(parent) , mLoadingProgressBar(this) diff --git a/src/web/browser/WBBrowserWindow.cpp b/src/web/browser/WBBrowserWindow.cpp index 39dd61e0..57b2c0e9 100644 --- a/src/web/browser/WBBrowserWindow.cpp +++ b/src/web/browser/WBBrowserWindow.cpp @@ -78,6 +78,7 @@ #include "ui_passworddialog.h" #include "WBWebView.h" +#include "core/memcheck.h" WBDownloadManager *WBBrowserWindow::sDownloadManager = 0; WBHistoryManager *WBBrowserWindow::sHistoryManager = 0; diff --git a/src/web/browser/WBChaseWidget.cpp b/src/web/browser/WBChaseWidget.cpp index d60b4bc7..8faf2f05 100644 --- a/src/web/browser/WBChaseWidget.cpp +++ b/src/web/browser/WBChaseWidget.cpp @@ -57,6 +57,8 @@ #include +#include "core/memcheck.h" + WBChaseWidget::WBChaseWidget(QWidget *parent, QPixmap pixmap, bool pixmapEnabled) : QWidget(parent) , mSegment(0) diff --git a/src/web/browser/WBDownloadManager.cpp b/src/web/browser/WBDownloadManager.cpp index 815e3ca3..f45976d8 100644 --- a/src/web/browser/WBDownloadManager.cpp +++ b/src/web/browser/WBDownloadManager.cpp @@ -66,6 +66,8 @@ #include +#include "core/memcheck.h" + /*! DownloadItem is a widget that is displayed in the download manager list. It moves the data from the QNetworkReply into the QFile as well diff --git a/src/web/browser/WBEditTableView.cpp b/src/web/browser/WBEditTableView.cpp index e2c2d4ae..7e9d1bb8 100644 --- a/src/web/browser/WBEditTableView.cpp +++ b/src/web/browser/WBEditTableView.cpp @@ -56,6 +56,8 @@ #include "WBEditTableView.h" #include +#include "core/memcheck.h" + WBEditTableView::WBEditTableView(QWidget *parent) : QTableView(parent) { diff --git a/src/web/browser/WBHistory.cpp b/src/web/browser/WBHistory.cpp index f5fe8d8b..caebebb7 100644 --- a/src/web/browser/WBHistory.cpp +++ b/src/web/browser/WBHistory.cpp @@ -63,6 +63,7 @@ #include "core/UBSettings.h" #include "network/UBAutoSaver.h" +#include "core/memcheck.h" static const unsigned int HISTORY_VERSION = 23; diff --git a/src/web/browser/WBModelMenu.cpp b/src/web/browser/WBModelMenu.cpp index cf0ff53b..8ba7faff 100644 --- a/src/web/browser/WBModelMenu.cpp +++ b/src/web/browser/WBModelMenu.cpp @@ -57,6 +57,8 @@ #include +#include "core/memcheck.h" + WBModelMenu::WBModelMenu(QWidget * parent) : QMenu(parent) , m_maxRows(7) diff --git a/src/web/browser/WBSearchLineEdit.cpp b/src/web/browser/WBSearchLineEdit.cpp index 5a4ea4d9..cc91b23d 100644 --- a/src/web/browser/WBSearchLineEdit.cpp +++ b/src/web/browser/WBSearchLineEdit.cpp @@ -57,6 +57,8 @@ #include +#include "core/memcheck.h" + WBClearButton::WBClearButton(QWidget *parent) : QAbstractButton(parent) { diff --git a/src/web/browser/WBSqueezeLabel.cpp b/src/web/browser/WBSqueezeLabel.cpp index 1ce36d47..f66bb349 100644 --- a/src/web/browser/WBSqueezeLabel.cpp +++ b/src/web/browser/WBSqueezeLabel.cpp @@ -55,6 +55,8 @@ #include "WBSqueezeLabel.h" +#include "core/memcheck.h" + WBSqueezeLabel::WBSqueezeLabel(QWidget *parent) : QLabel(parent) { } diff --git a/src/web/browser/WBTabWidget.cpp b/src/web/browser/WBTabWidget.cpp index d49fac7e..70b3b1d2 100644 --- a/src/web/browser/WBTabWidget.cpp +++ b/src/web/browser/WBTabWidget.cpp @@ -66,6 +66,8 @@ #include #include +#include "core/memcheck.h" + WBTabBar::WBTabBar(QWidget *parent) : QTabBar(parent) { diff --git a/src/web/browser/WBToolBarSearch.cpp b/src/web/browser/WBToolBarSearch.cpp index 520d6812..87b46b89 100644 --- a/src/web/browser/WBToolBarSearch.cpp +++ b/src/web/browser/WBToolBarSearch.cpp @@ -60,6 +60,8 @@ #include "network/UBAutoSaver.h" +#include "core/memcheck.h" + /* ToolbarSearch is a very basic search widget that also contains a small history. Searches are turned into urls that use Google to perform search diff --git a/src/web/browser/WBUrlLineEdit.cpp b/src/web/browser/WBUrlLineEdit.cpp index 8ee3ba0a..d2eb0911 100644 --- a/src/web/browser/WBUrlLineEdit.cpp +++ b/src/web/browser/WBUrlLineEdit.cpp @@ -60,6 +60,8 @@ #include +#include "core/memcheck.h" + WBExLineEdit::WBExLineEdit(QWidget *parent) : QWidget(parent) , mLeftWidget(0) diff --git a/src/web/browser/WBWebTrapWebView.cpp b/src/web/browser/WBWebTrapWebView.cpp index 62f5cd38..1792a51b 100644 --- a/src/web/browser/WBWebTrapWebView.cpp +++ b/src/web/browser/WBWebTrapWebView.cpp @@ -24,6 +24,8 @@ #include "core/UBApplicationController.h" #include "board/UBBoardController.h" +#include "core/memcheck.h" + WBWebTrapWebView::WBWebTrapWebView(QWidget* parent) : QWebView(parent) , mCurrentContentType(Unknown) diff --git a/src/web/browser/WBWebView.cpp b/src/web/browser/WBWebView.cpp index eb0be66f..7f794cbe 100644 --- a/src/web/browser/WBWebView.cpp +++ b/src/web/browser/WBWebView.cpp @@ -70,6 +70,7 @@ #include #include +#include "core/memcheck.h" WBWebPage::WBWebPage(QObject *parent) : UBWebPage(parent)