src/hbcore/utils/hboogmwatcher.cpp
branchGCC_SURGE
changeset 15 f378acbc9cfb
parent 5 627c4a0fd0e7
--- a/src/hbcore/utils/hboogmwatcher.cpp	Thu Jul 15 14:03:49 2010 +0100
+++ b/src/hbcore/utils/hboogmwatcher.cpp	Thu Jul 22 16:36:53 2010 +0100
@@ -58,15 +58,20 @@
   as possible in order to increase the amount of free graphics memory.
 */
 
+static bool oogmWatcherDeleted = false;
+
 /*!
     Returns the global HbOogmWatcher instance.
  */
 HbOogmWatcher *HbOogmWatcher::instance()
 {
+    if (oogmWatcherDeleted) {
+        return 0;
+    }
     static HbOogmWatcher *watcher = new HbOogmWatcher(qApp);
     return watcher;
 }
-    
+
 HbOogmWatcher::HbOogmWatcher(QObject *parent)
     : QObject(parent), d_ptr(new HbOogmWatcherPrivate)
 {
@@ -78,6 +83,7 @@
 HbOogmWatcher::~HbOogmWatcher()
 {
     delete d_ptr;
+    oogmWatcherDeleted = true;
 }
 
 /*!
@@ -96,10 +102,10 @@
 void HbOogmWatcherPrivate::graphicsMemoryLow()
 {
     qWarning("HbOogmWatcher::graphicsMemoryLow()");
-    if (mRenderMode == EHWRendering) {        
+    if (mRenderMode == EHWRendering) {
         mRenderMode = ESWRendering;
         HbIconLoader::global()->switchRenderingMode(mRenderMode);
-    }    
+    }
 #ifdef HB_EFFECTS_OPENVG
     // Destroy the cached pixmaps of effects. This is also necessary
     // to make the OpenVG filter effect caching working properly. (if
@@ -111,7 +117,7 @@
     // Drop the underlying pixmap data (if possible) for all HbIconItems that
     // are not currently visible.
     int n = 0;
-    foreach (HbIconItem *iconItem, mIconItems) {
+    foreach(HbIconItem * iconItem, mIconItems) {
         if (!iconItem->isVisible()) {
             HbIconItemPrivate::d_ptr(iconItem)->clearStoredIconContent();
             ++n;
@@ -127,10 +133,10 @@
 void HbOogmWatcherPrivate::graphicsMemoryGood()
 {
     qWarning("HbOogmWatcher::graphicsMemoryGood()");
-    if (mRenderMode == ESWRendering) {        
+    if (mRenderMode == ESWRendering) {
         mRenderMode = EHWRendering;
         HbIconLoader::global()->switchRenderingMode(mRenderMode);
-    }     
+    }
     emit q_ptr->graphicsMemoryGood();
 }