Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(500)

Unified Diff: xfa/src/fwl/src/core/fwl_widgetimp.cpp

Issue 1453473002: FWL refcounts never incremented (part 2). (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Rebased past part1. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: xfa/src/fwl/src/core/fwl_widgetimp.cpp
diff --git a/xfa/src/fwl/src/core/fwl_widgetimp.cpp b/xfa/src/fwl/src/core/fwl_widgetimp.cpp
index 92725ae3ffcdc49728bac700973d8e9f3e1bda0c..eef07ead33258b4d1f73df0452158eda7408760b 100644
--- a/xfa/src/fwl/src/core/fwl_widgetimp.cpp
+++ b/xfa/src/fwl/src/core/fwl_widgetimp.cpp
@@ -498,30 +498,15 @@ IFWL_Widget* CFWL_WidgetImp::GetInterface() const {
void CFWL_WidgetImp::SetInterface(IFWL_Widget* pInterface) {
m_pInterface = pInterface;
}
-CFWL_WidgetImp::CFWL_WidgetImp(IFWL_Widget* pOuter)
- : m_pProperties(NULL),
- m_pPrivateData(NULL),
- m_pDelegate(NULL),
- m_pCurDelegate(NULL),
- m_pOuter(pOuter),
- m_pInterface(NULL),
- m_iLock(0) {
- m_pProperties = new CFWL_WidgetImpProperties;
- m_pWidgetMgr = (CFWL_WidgetMgr*)FWL_GetWidgetMgr();
- FXSYS_assert(m_pWidgetMgr != NULL);
-}
CFWL_WidgetImp::CFWL_WidgetImp(const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter)
- : m_pProperties(NULL),
+ : m_pProperties(new CFWL_WidgetImpProperties),
m_pPrivateData(NULL),
m_pDelegate(NULL),
m_pCurDelegate(NULL),
m_pOuter(pOuter),
m_pInterface(NULL),
m_iLock(0) {
- if (!m_pProperties) {
- m_pProperties = new CFWL_WidgetImpProperties;
- }
*m_pProperties = properties;
m_pWidgetMgr = (CFWL_WidgetMgr*)FWL_GetWidgetMgr();
FXSYS_assert(m_pWidgetMgr != NULL);
@@ -1039,9 +1024,8 @@ FWL_ERR CFWL_WidgetImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics,
}
class CFWL_CustomImp : public CFWL_WidgetImp {
public:
- CFWL_CustomImp(IFWL_Widget* pOuter = NULL);
CFWL_CustomImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter = NULL);
+ IFWL_Widget* pOuter);
virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE);
virtual FWL_ERR Update();
virtual FWL_ERR SetProxy(IFWL_Proxy* pProxy);
@@ -1049,8 +1033,6 @@ class CFWL_CustomImp : public CFWL_WidgetImp {
protected:
IFWL_Proxy* m_pProxy;
};
-CFWL_CustomImp::CFWL_CustomImp(IFWL_Widget* pOuter)
- : CFWL_WidgetImp(pOuter), m_pProxy(NULL) {}
CFWL_CustomImp::CFWL_CustomImp(const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter)
: CFWL_WidgetImp(properties, pOuter), m_pProxy(NULL) {}
@@ -1071,15 +1053,17 @@ FWL_ERR CFWL_CustomImp::SetProxy(IFWL_Proxy* pProxy) {
m_pProxy = pProxy;
return FWL_ERR_Succeeded;
}
-IFWL_Custom::IFWL_Custom() {
-}
-FWL_ERR IFWL_Custom::Initialize(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter) {
+
+// static
+IFWL_Custom* IFWL_Custom::Create(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter) {
+ IFWL_Custom* pCustom = new IFWL_Custom;
CFWL_CustomImp* pCustomImpl = new CFWL_CustomImp(properties, pOuter);
- SetImpl(pCustomImpl);
- pCustomImpl->SetInterface(this);
- return pCustomImpl->Initialize();
+ pCustom->SetImpl(pCustomImpl);
+ pCustomImpl->SetInterface(pCustom);
+ return pCustom;
}
+IFWL_Custom::IFWL_Custom() {}
FWL_ERR IFWL_Custom::SetProxy(IFWL_Proxy* pProxy) {
return static_cast<CFWL_CustomImp*>(GetImpl())->SetProxy(pProxy);
}

Powered by Google App Engine
This is Rietveld 408576698