videocollection/videocollectionview/src/videocollectionviewplugin.cpp
changeset 41 229f037ce963
parent 37 4eb2df7f7cbe
child 58 d2b028fd1f7d
--- a/videocollection/videocollectionview/src/videocollectionviewplugin.cpp	Fri Jun 11 09:44:20 2010 +0300
+++ b/videocollection/videocollectionview/src/videocollectionviewplugin.cpp	Thu Jun 24 09:49:13 2010 +0300
@@ -15,7 +15,7 @@
 *
 */
 
-// Version : %version: 23 %
+// Version : %version: 24 %
 
 // INCLUDE FILES
 #include <xqplugin.h>
@@ -41,7 +41,7 @@
     : mUiLoader( 0 )
     , mView( 0 )
     , mActivated( false )
-    , mIsService( false )
+    , mVideoServices( 0 )
 {
 	FUNC_LOG;
 }
@@ -72,14 +72,8 @@
         }
 
         mUiLoader->reset();
-
-        if (XQServiceUtil::isService())
-        {
-        	INFO("VideoCollectionViewPlugin::createView() service flag set to true.");
-            mIsService = true;
-        }
         
-        mUiLoader->setIsService(mIsService);
+        mUiLoader->setIsService(XQServiceUtil::isService());
 
 		bool ok(false);
 
@@ -145,6 +139,12 @@
     mView = 0;
     delete mUiLoader;
     mUiLoader = 0;
+    
+    if(mVideoServices)
+    {
+        mVideoServices->decreaseReferenceCount();
+        mVideoServices = 0;
+    }
 }
 
 // ---------------------------------------------------------------------------
@@ -163,17 +163,18 @@
             bool isService = XQServiceUtil::isService();
             if (isService)
             {
-                VideoServices *videoServices = VideoServices::instance();
-                if (videoServices)
+                if(!mVideoServices)
                 {
-                    VideoServices::TVideoService serviceType =
-                        videoServices->currentService();
-                    if (serviceType == VideoServices::EBrowse)
-                    {
-                        // activate browsing service
-                        itemId.iId1 = videoServices->getBrowseCategory();
-                        itemId.iId2 = KVcxMvcMediaTypeCategory;
-                    }
+                    mVideoServices = VideoServices::instance();
+                }
+
+                VideoServices::TVideoService serviceType =
+                        mVideoServices->currentService();
+                if (serviceType == VideoServices::EBrowse)
+                {
+                    // activate browsing service
+                    itemId.iId1 = mVideoServices->getBrowseCategory();
+                    itemId.iId2 = KVcxMvcMediaTypeCategory;
                 }
             }
             int err = mView->activateView(itemId);