Fix usb bug 68/37768/3
authorJuWan Kim <juwan.kim@samsung.com>
Fri, 3 Apr 2015 23:43:00 +0000 (08:43 +0900)
committerJuWan Kim <juwan.kim@samsung.com>
Fri, 3 Apr 2015 23:48:02 +0000 (08:48 +0900)
    * When checking usb connection is failed, app should be worked.

Change-Id: I2831215b2bbdaf07e4af961c954963cb39c321c0
Signed-off-by: JuWan Kim <juwan.kim@samsung.com>
src/views/BaseView/FbBaseView.cpp
src/views/BaseView/SourceCtxPopup.cpp

index eaadef9..bf87f87 100644 (file)
@@ -600,13 +600,14 @@ bool CFbBaseView::Create(void *data)
                _CHECK(m->pLayoutMgr->AddLayout(m->pFbPhotoLayout))
                _CHECK(m->pLayoutMgr->AddLayout(m->pFbVideoLayout))
                _CHECK(m->pLayoutMgr->AddLayout(m->pFbMusicLayout))
-               _CHECK(CUsbConnectionListener::Create())
-               _CHECK(CMediaContentDbUpdateListener::Create())
-
+               _COMMAND{
+                       if(!CUsbConnectionListener::Create())
+                               _ERR("Fail to create CUsbConnectionListener()");
+                       if(!CMediaContentDbUpdateListener::Create())
+                               _ERR("Fail to create CMediaContentDbUpdateListener()");
+               }
                _WHEN_SUCCESS{}
 
-               _CHECK_FAIL{ CMediaContentDbUpdateListener::Destroy(); }
-               _CHECK_FAIL{ CUsbConnectionListener::Destroy(); }
                _CHECK_FAIL{ m->pLayoutMgr->RemoveLayout(m->pFbMusicLayout); }
                _CHECK_FAIL{ m->pLayoutMgr->RemoveLayout(m->pFbVideoLayout); }
                _CHECK_FAIL{ m->pLayoutMgr->RemoveLayout(m->pFbPhotoLayout); }
@@ -644,8 +645,11 @@ void CFbBaseView::Destroy(void)
        ASSERT(m);
 
        CBaseView::Destroy();
-       CMediaContentDbUpdateListener::Destroy();
-       CUsbConnectionListener::Destroy();
+
+       if(CMediaContentDbUpdateListener::FlagCreate())
+               CMediaContentDbUpdateListener::Destroy();
+       if(CUsbConnectionListener::FlagCreate())
+               CUsbConnectionListener::Destroy();
 
        m->pLayoutMgr->RemoveLayout(m->pFbMusicLayout);
        m->pFbMusicLayout->Destroy();
index dffd319..36697d3 100644 (file)
@@ -45,10 +45,13 @@ void CSourceCtxPopup::t_OnConfiguration(void)
        int size = ARRAY_SIZE(sourcetext);
 
        CUsbConnectionListener usb;
-       usb.Create();
-       if (!usb.FlagConnected())
+       if(usb.Create()) {
+               if (!usb.FlagConnected())
+                       size--;
+               usb.Destroy();
+       }
+       else
                size--;
-       usb.Destroy();
 
        t_SetList(sourcetext, size, (int)CInfo::SourceType(),
                        CCtxPopup::TOPBTN_SOURCE, srcbtnids,