scrsaver/scrsaverplugins/SlideshowPlugin/src/SlideshowPlugin.cpp
branchRCL_3
changeset 24 fc25e03508fd
parent 23 e8d784ac1a4b
--- a/scrsaver/scrsaverplugins/SlideshowPlugin/src/SlideshowPlugin.cpp	Wed Sep 01 12:30:40 2010 +0100
+++ b/scrsaver/scrsaverplugins/SlideshowPlugin/src/SlideshowPlugin.cpp	Tue Sep 14 21:20:26 2010 +0300
@@ -134,8 +134,19 @@
     delete iDrmHelper;
     delete iModel;
 
-    // First model, then engine, otherwise bad things happen
-    delete iMdESession;
+    // Close and delete mds query
+    if ( iQuery )
+        {
+        iQuery->Cancel();
+        delete iQuery;
+        iQuery = NULL;
+        }
+
+	if ( iMdESession )
+        {
+        delete iMdESession;
+        iMdESession = NULL;
+        }
     
     // Logging done
     SSPLOGGER_DELETE;
@@ -1001,9 +1012,9 @@
     CMdEObjectDef& imageObjDef = defaultNamespaceDef.GetObjectDefL( MdeConstants::Image::KImageObject );
 
     // query objects with object definition "Image"
-    CMdEObjectQuery* query = iMdESession->NewObjectQueryL( defaultNamespaceDef, imageObjDef, this );
+    iQuery = iMdESession->NewObjectQueryL( defaultNamespaceDef, imageObjDef, this );
 
-    query->FindL( KDefaultRandomLoadingNumber );
+    iQuery->FindL( KDefaultRandomLoadingNumber );
     }
 
 // -----------------------------------------------------------------------------