From 77221d4b4288ada80e34464ef4a402ea232b402b Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 8 Dec 2015 11:20:08 -0800 Subject: FWL refcounts never incremented (part 1) BUG=pdfium:282 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1509203002 . --- xfa/include/fwl/core/fwl_form.h | 5 +---- xfa/include/fwl/core/fwl_note.h | 7 +++++-- xfa/include/fwl/core/fwl_target.h | 9 ++------- 3 files changed, 8 insertions(+), 13 deletions(-) (limited to 'xfa/include/fwl/core') diff --git a/xfa/include/fwl/core/fwl_form.h b/xfa/include/fwl/core/fwl_form.h index 6d76c614d0..439d1cb554 100644 --- a/xfa/include/fwl/core/fwl_form.h +++ b/xfa/include/fwl/core/fwl_form.h @@ -65,7 +65,7 @@ enum FWL_COMMANDID { }; class IFWL_Form : public IFWL_Panel { public: - static IFWL_Form* Create(); + IFWL_Form(); FWL_ERR Initialize(CFWL_WidgetImpProperties& properties, CFX_WideString* classname, IFWL_Widget* pOuter); @@ -75,8 +75,5 @@ class IFWL_Form : public IFWL_Panel { IFWL_Widget* DoModal(FX_DWORD& dwCommandID); FWL_ERR EndDoModal(); FWL_ERR SetBorderRegion(CFX_Path* pPath); - - protected: - IFWL_Form(); }; #endif diff --git a/xfa/include/fwl/core/fwl_note.h b/xfa/include/fwl/core/fwl_note.h index 66366e92e4..e6579bff10 100644 --- a/xfa/include/fwl/core/fwl_note.h +++ b/xfa/include/fwl/core/fwl_note.h @@ -120,6 +120,9 @@ class IFWL_NoteLoop; #define FWL_KEYFLAG_LButton (1 << 4) #define FWL_KEYFLAG_RButton (1 << 5) #define FWL_KEYFLAG_MButton (1 << 6) + +// Separate hierarchy not related to IFWL_* hierarchy. These should not +// get cast to IFWL_* types. class CFWL_Note { public: virtual FX_DWORD Release() { @@ -130,9 +133,9 @@ class CFWL_Note { } return dwRefCount; } - virtual IFWL_Target* Retain() { + virtual CFWL_Note* Retain() { m_dwRefCount++; - return (IFWL_Target*)this; + return this; } virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const { wsClass = L"CFWL_Note"; diff --git a/xfa/include/fwl/core/fwl_target.h b/xfa/include/fwl/core/fwl_target.h index bf5cf83f3a..dc10ca5399 100644 --- a/xfa/include/fwl/core/fwl_target.h +++ b/xfa/include/fwl/core/fwl_target.h @@ -16,7 +16,7 @@ // (nonesuch) IFWL_Target ----------> CFWL_TargetImp // | | // A A -// m_pIface | | +// m_pIface | | // CFWL_Widget ----------> IFWL_Widget CFWL_WidgetImp // | | | // A A A @@ -29,10 +29,8 @@ class CFWL_TargetImp; class IFWL_Target { public: IFWL_Target() : m_pImpl(nullptr) {} + virtual ~IFWL_Target(); - FX_DWORD Release(); - IFWL_Target* Retain(); - FX_DWORD GetRefCount() const; FWL_ERR GetClassName(CFX_WideString& wsClass) const; FX_DWORD GetClassID() const; FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const; @@ -42,9 +40,6 @@ class IFWL_Target { CFWL_TargetImp* GetImpl() const { return m_pImpl; } void SetImpl(CFWL_TargetImp* pImpl) { m_pImpl = pImpl; } - protected: - virtual ~IFWL_Target(); - private: CFWL_TargetImp* m_pImpl; }; -- cgit v1.2.3