fix certificate popup crash issue
authorSeongjun Yim <se201.yim@samsung.com>
Fri, 19 Jul 2013 12:06:20 +0000 (21:06 +0900)
committerSeongjun Yim <se201.yim@samsung.com>
Fri, 19 Jul 2013 12:06:20 +0000 (21:06 +0900)
Change-Id: I4854afabdd884fb9d07d0d372646e4143aa68c97
Signed-off-by: Seongjun Yim <se201.yim@samsung.com>
src/controls/FWebCtrl_CertificateConfirmPopup.cpp
src/controls/FWebCtrl_WebImpl.cpp
src/controls/FWebCtrl_WebManager.cpp
src/controls/FWebCtrl_WebPopup.cpp [changed mode: 0644->0755]
src/controls/inc/FWebCtrl_WebImpl.h
src/controls/inc/FWebCtrl_WebPopup.h

index 711bbf4..8308dd3 100755 (executable)
@@ -228,7 +228,7 @@ _CertificateConfirmPopup::OnActionPerformed(const Control& source, int actionId)
                std::unique_ptr<_CertificateConfirmPopup> pCertificatePopup(new (std::nothrow) _CertificateConfirmPopup());
                SysTryReturnVoidResult(NID_WEB_CTRL, pCertificatePopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
 
-               r = pCertificatePopup->Construct(CERTIFICATE_POPUP_MODE_VIEW, __pCertificatePolicyData, null);
+               r = pCertificatePopup->Construct(CERTIFICATE_POPUP_MODE_VIEW, __pCertificatePolicyData, __pImpl);
                SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
 
                r = pCertificatePopup->ShowPopup();
index 47067cb..c308c2a 100755 (executable)
@@ -2213,13 +2213,6 @@ _WebImpl::_WebImpl(Web* pWeb, Tizen::Ui::_Control* pCore)
 
 _WebImpl::~_WebImpl()
 {
-       _WebManager* pWebManager = _WebManager::GetInstance();
-       pWebManager->RemoveWeb(reinterpret_cast< int >(this));
-
-       _DownloadManagerImpl* pManagerImpl = _DownloadManagerImpl::GetInstance();
-       pManagerImpl->SetDownloadListener(null);
-
-       RemoveEventListenerCallback();
        ClearCertificateDb();
 }
 
@@ -2314,9 +2307,6 @@ _WebImpl::Construct(void)
        __pWebCore = dynamic_cast< _Web* >(&(GetCore()));
        SysTryReturnResult(NID_WEB_CTRL, __pWebCore, E_SYSTEM, "A system error has been occurred. Failed to get web control");
 
-       _WebManager* pWebManager = _WebManager::GetInstance();
-       pWebManager->AddWeb(reinterpret_cast< int >(this));
-
        return E_SUCCESS;
 }
 
@@ -4867,12 +4857,35 @@ _WebImpl::OnPreAttachedToMainTree(void)
        r = __pWebCore->InitializeWebNativeNode();
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
+       _ControlManager* pControlManager = _ControlManager::GetInstance();
+       SysTryReturnResult(NID_WEB_CTRL, pControlManager, E_SYSTEM, "Failed to get the ControlManager instance.");
+       OnChangeLayout(pControlManager->GetScreenRotation());
+
        r = InitializeSetting();
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
        r = _ContainerImpl::OnPreAttachedToMainTree();
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
+       _WebManager* pWebManager = _WebManager::GetInstance();
+       pWebManager->AddWeb(reinterpret_cast< int >(this));
+
+       return E_SUCCESS;
+}
+
+
+result
+_WebImpl::OnDetachingFromMainTree(void)
+{
+       _WebManager* pWebManager = _WebManager::GetInstance();
+       pWebManager->RemoveWeb(reinterpret_cast< int >(this));
+       pWebManager->RemoveActiveWeb(this);     
+
+       _DownloadManagerImpl* pManagerImpl = _DownloadManagerImpl::GetInstance();
+       pManagerImpl->SetDownloadListener(null);
+
+       RemoveEventListenerCallback();
+
        return E_SUCCESS;
 }
 
index 64691ff..d62b8c7 100755 (executable)
@@ -193,7 +193,6 @@ _WebManager::SetActiveWeb(Tizen::Web::Controls::_WebImpl* pWebAddress)
                __pActivePopup->SetShowState(true);\r
                __pActivePopup->Show();\r
        }\r
-\r
 }\r
 \r
 void\r
old mode 100644 (file)
new mode 100755 (executable)
index 71dd038..3257d13
@@ -51,14 +51,6 @@ _WebPopup::_WebPopup(void)
 
 _WebPopup::~_WebPopup(void)
 {
-       _WebManager* pWebManager = _WebManager::GetInstance();
-       pWebManager->RemoveActivePopup(this);
-
-       if (IsModalPopup() == true)
-       {
-               HidePopup(0);
-       }
-
        __pWebPopupData.reset();
 }
 
@@ -257,4 +249,11 @@ _WebPopup::GetPopupData(bool refresh)
 }
 
 
+result
+_WebPopup::OnTerminating(void)
+{
+       return HidePopup();
+}
+
+
 }}} // Tizen::Web::Controls
index 4212e09..267719f 100755 (executable)
@@ -389,6 +389,8 @@ public:
 
        virtual result OnPreAttachedToMainTree(void);
 
+       virtual result OnDetachingFromMainTree(void);
+
        virtual void OnChangeLayout(Tizen::Ui::_ControlRotation rotation);
 
        virtual void OnChangeLayout(Tizen::Ui::_ControlOrientation orientation);
index 752e345..52f3deb 100755 (executable)
@@ -122,6 +122,8 @@ private:
 
        _WebPopup& operator =(const _WebPopup& source);
 
+       virtual result OnTerminating(void);
+
 private:
        static std::unique_ptr<_WebPopupData> __pWebPopupData;
        bool __isModal;