[Libreoffice-commits] core.git: Branch 'feature/vclref' - include/vcl sw/source vcl/source
Michael Meeks
michael.meeks at collabora.com
Tue Mar 24 10:48:55 PDT 2015
include/vcl/window.hxx | 8 ++------
sw/source/uibase/docvw/HeaderFooterWin.cxx | 6 ++++++
sw/source/uibase/docvw/PageBreakWin.cxx | 5 +++++
vcl/source/window/window.cxx | 21 ++++++++++++++++-----
4 files changed, 29 insertions(+), 11 deletions(-)
New commits:
commit 8ce8b120c6999af23383cef391a24034e74c6ec6
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Tue Mar 24 17:52:38 2015 +0000
vcl: remove curious self referential OutputDevice ptr.
No need to pay a per-instance cost for this, also avoid a self
reference for every Window sub-class.
Change-Id: I040a0ede9481229e43a39bc23297969e90b95f5e
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index bf1d0c8..c5e004f 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -401,10 +401,6 @@ private:
WindowImpl* mpWindowImpl;
- // This is a first attempt to start to remove the dependency of Window on
- // OutputDevice
- VclPtr<::OutputDevice> mpOutputDevice;
-
#ifdef DBG_UTIL
friend const char* ::ImplDbgCheckWindow( const void* pObj );
#endif
@@ -681,8 +677,8 @@ public:
Window( vcl::Window* pParent, const ResId& rResId );
virtual ~Window();
- ::OutputDevice const* GetOutDev() const { return mpOutputDevice; };
- ::OutputDevice* GetOutDev() { return mpOutputDevice; };
+ ::OutputDevice const* GetOutDev() const;
+ ::OutputDevice* GetOutDev();
virtual void EnableRTL ( bool bEnable = true ) SAL_OVERRIDE;
virtual void MouseMove( const MouseEvent& rMEvt );
diff --git a/sw/source/uibase/docvw/HeaderFooterWin.cxx b/sw/source/uibase/docvw/HeaderFooterWin.cxx
index 2e80768..6698baa 100644
--- a/sw/source/uibase/docvw/HeaderFooterWin.cxx
+++ b/sw/source/uibase/docvw/HeaderFooterWin.cxx
@@ -165,6 +165,11 @@ SwHeaderFooterWin::SwHeaderFooterWin( SwEditWin* pEditWin, const SwPageFrm* pPag
m_aFadeTimer.SetTimeout( 50 );
m_aFadeTimer.SetTimeoutHdl( LINK( this, SwHeaderFooterWin, FadeHandler ) );
+
+ // FIXME: unwind this by de-coupling SwFrmControl from SwHeaderFooterWin
+ // We will be explicitly lifecycle managed alongside SwFrmControl parent
+ // so we take a reference here which we know will never be released.
+ new VclPtr<SwHeaderFooterWin>(this);
}
SwHeaderFooterWin::~SwHeaderFooterWin( )
@@ -175,6 +180,7 @@ SwHeaderFooterWin::~SwHeaderFooterWin( )
void SwHeaderFooterWin::dispose()
{
delete m_pPopupMenu;
+ m_pPopupMenu = NULL;
m_pLine.disposeAndClear();
MenuButton::dispose();
}
diff --git a/sw/source/uibase/docvw/PageBreakWin.cxx b/sw/source/uibase/docvw/PageBreakWin.cxx
index b19a57e..baf1443 100644
--- a/sw/source/uibase/docvw/PageBreakWin.cxx
+++ b/sw/source/uibase/docvw/PageBreakWin.cxx
@@ -114,6 +114,11 @@ SwPageBreakWin::SwPageBreakWin( SwEditWin* pEditWin, const SwPageFrm* pPageFrm )
m_aFadeTimer.SetTimeout( 50 );
m_aFadeTimer.SetTimeoutHdl( LINK( this, SwPageBreakWin, FadeHandler ) );
+
+ // FIXME: unwind this by de-coupling SwFrmControl from SwHeaderFooterWin
+ // We will be explicitly lifecycle managed alongside SwFrmControl parent
+ // so we take a reference here which we know will never be released.
+ new VclPtr<SwPageBreakWin>(this);
}
SwPageBreakWin::~SwPageBreakWin( )
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 510482f..c80e180 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -581,6 +581,22 @@ Window::~Window()
disposeOnce();
}
+// We will eventually being removing the inheritance of OutputDevice
+// from Window. It will be replaced with a transient relationship such
+// that the OutputDevice is only live for the scope of the Paint method.
+// In the meantime this can help move us towards a Window use an
+// OutputDevice, not being one.
+
+::OutputDevice const* Window::GetOutDev() const
+{
+ return this;
+}
+
+::OutputDevice* Window::GetOutDev()
+{
+ return this;
+}
+
} /* namespace vcl */
WindowImpl::WindowImpl( WindowType nType )
@@ -1195,11 +1211,6 @@ void Window::ImplInitAppFontData( vcl::Window* pWindow )
void Window::ImplInitWindowData( WindowType nType )
{
- // We will eventually being removing the inheritance of OutputDevice from Window.
- // It will be replaced with a composition relationship. A Window will use an OutputDevice,
- // it will not *be* an OutputDevice
- mpOutputDevice = (OutputDevice*)this;
-
mnRefCnt = 0;
mpWindowImpl = new WindowImpl( nType );
More information about the Libreoffice-commits
mailing list