include/svx/sidebar/PanelLayout.hxx | 1 include/svx/sidebar/Popup.hxx | 2 - include/vcl/vclptr.hxx | 22 +++++++++++++++--- sfx2/source/sidebar/Deck.cxx | 2 - svx/source/sidebar/PanelFactory.cxx | 12 ++++----- svx/source/sidebar/area/AreaPropertyPanel.cxx | 16 +++++++------ svx/source/sidebar/area/AreaPropertyPanel.hxx | 4 +-- svx/source/sidebar/graphic/GraphicPropertyPanel.cxx | 12 +++++---- svx/source/sidebar/graphic/GraphicPropertyPanel.hxx | 2 - svx/source/sidebar/line/LinePropertyPanel.cxx | 10 ++++---- svx/source/sidebar/line/LinePropertyPanel.hxx | 4 +-- svx/source/sidebar/paragraph/ParaPropertyPanel.cxx | 14 ++++++----- svx/source/sidebar/paragraph/ParaPropertyPanel.hxx | 2 - svx/source/sidebar/possize/PosSizePropertyPanel.cxx | 14 ++++++----- svx/source/sidebar/possize/PosSizePropertyPanel.hxx | 2 - svx/source/sidebar/text/TextCharacterSpacingPopup.cxx | 2 - svx/source/sidebar/text/TextCharacterSpacingPopup.hxx | 2 - svx/source/sidebar/text/TextPropertyPanel.cxx | 22 +++++++++--------- svx/source/sidebar/text/TextPropertyPanel.hxx | 6 ++-- vcl/qa/cppunit/lifecycle.cxx | 2 - vcl/source/opengl/OpenGLContext.cxx | 2 - vcl/workben/vcldemo.cxx | 2 - 22 files changed, 93 insertions(+), 64 deletions(-)
New commits: commit 26fced1cd40e8c4631df16451711af893460a1cf Author: Michael Meeks <michael.me...@collabora.com> Date: Mon Apr 13 22:51:42 2015 +0100 Re-work sidebar factory to use VclPtr. Change-Id: Iccbf4166419eee9f78f036d1abe07bba028d09e6 diff --git a/include/svx/sidebar/PanelLayout.hxx b/include/svx/sidebar/PanelLayout.hxx index e4db4f0..82790a4 100644 --- a/include/svx/sidebar/PanelLayout.hxx +++ b/include/svx/sidebar/PanelLayout.hxx @@ -16,6 +16,7 @@ #include <vcl/ctrl.hxx> #include <vcl/timer.hxx> #include <vcl/idle.hxx> +#include <vcl/vclptr.hxx> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/frame/XFrame.hpp> diff --git a/include/svx/sidebar/Popup.hxx b/include/svx/sidebar/Popup.hxx index bcd0bde..67d4c1c 100644 --- a/include/svx/sidebar/Popup.hxx +++ b/include/svx/sidebar/Popup.hxx @@ -91,7 +91,7 @@ protected: private: VclPtr<vcl::Window> mpParent; - ::boost::function<PopupControl*(PopupContainer*)> maControlCreator; + ::boost::function<VclPtr<PopupControl>(PopupContainer*)> maControlCreator; ::boost::function<void(void)> maPopupModeEndCallback; const ::rtl::OUString msAccessibleName; VclPtr<PopupContainer> mxContainer; diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx index 9dcccbc..a44217c 100644 --- a/sfx2/source/sidebar/Deck.cxx +++ b/sfx2/source/sidebar/Deck.cxx @@ -90,11 +90,11 @@ void Deck::dispose() aPanels[i].disposeAndClear(); maPanels.clear(); - mpTitleBar.disposeAndClear(); mpFiller.disposeAndClear(); mpVerticalScrollBar.disposeAndClear(); mpScrollContainer.disposeAndClear(); mpScrollClipWindow.disposeAndClear(); + mpTitleBar.disposeAndClear(); vcl::Window::dispose(); } diff --git a/svx/source/sidebar/PanelFactory.cxx b/svx/source/sidebar/PanelFactory.cxx index e5a0cad..9e80936 100644 --- a/svx/source/sidebar/PanelFactory.cxx +++ b/svx/source/sidebar/PanelFactory.cxx @@ -137,7 +137,7 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement ( "PanelFactory::createUIElement called without SfxBindings", NULL); - vcl::Window* pControl = NULL; + VclPtr<vcl::Window> pControl; ui::LayoutSize aLayoutSize (-1,-1,-1); if (rsResourceURL.endsWith("/TextPropertyPanel")) @@ -166,25 +166,25 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement ( } else if (rsResourceURL.endsWith("/InsertPropertyPanel")) { - pControl = new InsertPropertyPanel(pParentWindow, xFrame); + pControl.reset(VclPtr<InsertPropertyPanel>::Create(pParentWindow, xFrame)); } else if (rsResourceURL.endsWith("/GalleryPanel")) { - pControl = new GalleryControl(pBindings, pParentWindow); + pControl.reset(VclPtr<GalleryControl>::Create(pBindings, pParentWindow)); aLayoutSize = ui::LayoutSize(300,-1,400); } else if (rsResourceURL.endsWith("/StyleListPanel")) { - pControl = new SfxTemplatePanelControl(pBindings, pParentWindow); + pControl.reset(VclPtr<SfxTemplatePanelControl>::Create(pBindings, pParentWindow)); aLayoutSize = ui::LayoutSize(0,-1,-1); } else if (rsResourceURL.endsWith("/EmptyPanel")) { - pControl = new EmptyPanel(pParentWindow); + pControl.reset(VclPtr<EmptyPanel>::Create(pParentWindow)); aLayoutSize = ui::LayoutSize(20,-1, 50); } - if (pControl != NULL) + if (pControl) { return sfx2::sidebar::SidebarPanelBase::Create( rsResourceURL, diff --git a/svx/source/sidebar/area/AreaPropertyPanel.cxx b/svx/source/sidebar/area/AreaPropertyPanel.cxx index 0063d05..bc731f9 100644 --- a/svx/source/sidebar/area/AreaPropertyPanel.cxx +++ b/svx/source/sidebar/area/AreaPropertyPanel.cxx @@ -493,9 +493,9 @@ IMPL_LINK( AreaPropertyPanel, SelectFillAttrHdl, ListBox*, pToolBox ) } -PopupControl* AreaPropertyPanel::CreateTransparencyGradientControl (PopupContainer* pParent) +VclPtr<PopupControl> AreaPropertyPanel::CreateTransparencyGradientControl (PopupContainer* pParent) { - return new AreaTransparencyGradientControl(pParent, *this); + return VclPtrInstance<AreaTransparencyGradientControl>(pParent, *this); } @@ -515,7 +515,7 @@ void AreaPropertyPanel::SetupIcons(void) -AreaPropertyPanel* AreaPropertyPanel::Create ( +VclPtr<vcl::Window> AreaPropertyPanel::Create ( vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings) @@ -527,10 +527,12 @@ AreaPropertyPanel* AreaPropertyPanel::Create ( if (pBindings == NULL) throw lang::IllegalArgumentException("no SfxBindings given to AreaPropertyPanel::Create", NULL, 2); - return new AreaPropertyPanel( - pParent, - rxFrame, - pBindings); + return VclPtr<vcl::Window>( + new AreaPropertyPanel( + pParent, + rxFrame, + pBindings), + SAL_NO_ACQUIRE); } diff --git a/svx/source/sidebar/area/AreaPropertyPanel.hxx b/svx/source/sidebar/area/AreaPropertyPanel.hxx index 12243fd..76c5baf 100644 --- a/svx/source/sidebar/area/AreaPropertyPanel.hxx +++ b/svx/source/sidebar/area/AreaPropertyPanel.hxx @@ -57,7 +57,7 @@ public: virtual ~AreaPropertyPanel(); virtual void dispose() SAL_OVERRIDE; - static AreaPropertyPanel* Create( + static VclPtr<vcl::Window> Create( vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings); @@ -147,7 +147,7 @@ private: DECL_LINK(ModifyTransparentHdl_Impl, void*); // for transparency gradient - PopupControl* CreateTransparencyGradientControl (PopupContainer* pParent); + VclPtr<PopupControl> CreateTransparencyGradientControl (PopupContainer* pParent); DECL_LINK( ClickTrGrHdl_Impl, ToolBox* ); // constructor/destuctor diff --git a/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx b/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx index 8ac484d8..933b5f3 100644 --- a/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx +++ b/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx @@ -232,7 +232,7 @@ void GraphicPropertyPanel::SetupIcons(void) -GraphicPropertyPanel* GraphicPropertyPanel::Create ( +VclPtr<vcl::Window> GraphicPropertyPanel::Create ( vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings) @@ -244,10 +244,12 @@ GraphicPropertyPanel* GraphicPropertyPanel::Create ( if (pBindings == NULL) throw lang::IllegalArgumentException("no SfxBindings given to GraphicPropertyPanel::Create", NULL, 2); - return new GraphicPropertyPanel( - pParent, - rxFrame, - pBindings); + return VclPtr<vcl::Window>( + new GraphicPropertyPanel( + pParent, + rxFrame, + pBindings), + SAL_NO_ACQUIRE); } diff --git a/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx b/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx index 691d45f..85b1d39 100644 --- a/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx +++ b/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx @@ -42,7 +42,7 @@ public: virtual ~GraphicPropertyPanel(); virtual void dispose() SAL_OVERRIDE; - static GraphicPropertyPanel* Create( + static VclPtr<vcl::Window> Create( vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings); diff --git a/svx/source/sidebar/line/LinePropertyPanel.cxx b/svx/source/sidebar/line/LinePropertyPanel.cxx index 5ff67de..12b0f33 100644 --- a/svx/source/sidebar/line/LinePropertyPanel.cxx +++ b/svx/source/sidebar/line/LinePropertyPanel.cxx @@ -286,7 +286,7 @@ void LinePropertyPanel::SetupIcons(void) } } -LinePropertyPanel* LinePropertyPanel::Create ( +VclPtr<vcl::Window> LinePropertyPanel::Create ( vcl::Window* pParent, const uno::Reference<frame::XFrame>& rxFrame, SfxBindings* pBindings) @@ -298,7 +298,9 @@ LinePropertyPanel* LinePropertyPanel::Create ( if (pBindings == NULL) throw lang::IllegalArgumentException("no SfxBindings given to LinePropertyPanel::Create", NULL, 2); - return new LinePropertyPanel(pParent, rxFrame, pBindings); + return VclPtr<vcl::Window>( + new LinePropertyPanel(pParent, rxFrame, pBindings), + SAL_NO_ACQUIRE); } void LinePropertyPanel::DataChanged(const DataChangedEvent& /*rEvent*/) @@ -769,9 +771,9 @@ IMPL_LINK( LinePropertyPanel, ChangeTransparentHdl, void *, EMPTYARG ) return 0L; } -PopupControl* LinePropertyPanel::CreateLineWidthPopupControl (PopupContainer* pParent) +VclPtr<PopupControl> LinePropertyPanel::CreateLineWidthPopupControl (PopupContainer* pParent) { - return new LineWidthControl(pParent, *this); + return VclPtrInstance<LineWidthControl>(pParent, *this); } void LinePropertyPanel::EndLineWidthPopupMode (void) diff --git a/svx/source/sidebar/line/LinePropertyPanel.hxx b/svx/source/sidebar/line/LinePropertyPanel.hxx index 2567a5e..626e2ac 100644 --- a/svx/source/sidebar/line/LinePropertyPanel.hxx +++ b/svx/source/sidebar/line/LinePropertyPanel.hxx @@ -63,7 +63,7 @@ public: virtual ~LinePropertyPanel(); virtual void dispose() SAL_OVERRIDE; - static LinePropertyPanel* Create( + static VclPtr<vcl::Window> Create( vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings); @@ -161,7 +161,7 @@ private: const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings); - PopupControl* CreateLineWidthPopupControl (PopupContainer* pParent); + VclPtr<PopupControl> CreateLineWidthPopupControl (PopupContainer* pParent); }; } } // end of namespace svx::sidebar diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx index b84a068..8ba3f99 100644 --- a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx +++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx @@ -55,7 +55,7 @@ namespace svx {namespace sidebar { #define MAX_SC_SD 116220200 #define NEGA_MAXVALUE -10000000 -ParaPropertyPanel* ParaPropertyPanel::Create ( +VclPtr<vcl::Window> ParaPropertyPanel::Create ( vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings, @@ -68,11 +68,13 @@ ParaPropertyPanel* ParaPropertyPanel::Create ( if (pBindings == NULL) throw lang::IllegalArgumentException("no SfxBindings given to ParaPropertyPanel::Create", NULL, 2); - return new ParaPropertyPanel( - pParent, - rxFrame, - pBindings, - rxSidebar); + return VclPtr<vcl::Window>( + new ParaPropertyPanel( + pParent, + rxFrame, + pBindings, + rxSidebar), + SAL_NO_ACQUIRE); } void ParaPropertyPanel::HandleContextChange ( diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx index 2b4d877..9eddf1f 100644 --- a/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx +++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx @@ -46,7 +46,7 @@ public: virtual ~ParaPropertyPanel(); virtual void dispose() SAL_OVERRIDE; - static ParaPropertyPanel* Create ( + static VclPtr<vcl::Window> Create ( vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings, diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx index cfb5939d..b352332 100644 --- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx +++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx @@ -232,7 +232,7 @@ void PosSizePropertyPanel::SetupIcons(void) -PosSizePropertyPanel* PosSizePropertyPanel::Create ( +VclPtr<vcl::Window> PosSizePropertyPanel::Create ( vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings, @@ -245,11 +245,13 @@ PosSizePropertyPanel* PosSizePropertyPanel::Create ( if (pBindings == NULL) throw lang::IllegalArgumentException("no SfxBindings given to PosSizePropertyPanel::Create", NULL, 2); - return new PosSizePropertyPanel( - pParent, - rxFrame, - pBindings, - rxSidebar); + return VclPtr<vcl::Window>( + new PosSizePropertyPanel( + pParent, + rxFrame, + pBindings, + rxSidebar), + SAL_NO_ACQUIRE); } diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.hxx b/svx/source/sidebar/possize/PosSizePropertyPanel.hxx index d8a2685..a5148b6 100644 --- a/svx/source/sidebar/possize/PosSizePropertyPanel.hxx +++ b/svx/source/sidebar/possize/PosSizePropertyPanel.hxx @@ -53,7 +53,7 @@ public: virtual ~PosSizePropertyPanel(); virtual void dispose() SAL_OVERRIDE; - static PosSizePropertyPanel* Create( + static VclPtr<vcl::Window> Create( vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings, diff --git a/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx b/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx index 57ea21a..cc62343 100644 --- a/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx +++ b/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx @@ -25,7 +25,7 @@ namespace svx { namespace sidebar { TextCharacterSpacingPopup::TextCharacterSpacingPopup ( vcl::Window* pParent, - const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator) + const ::boost::function<VclPtr<PopupControl>(PopupContainer*)>& rControlCreator) : Popup( pParent, rControlCreator, diff --git a/svx/source/sidebar/text/TextCharacterSpacingPopup.hxx b/svx/source/sidebar/text/TextCharacterSpacingPopup.hxx index 17ad29c..0c4331f 100644 --- a/svx/source/sidebar/text/TextCharacterSpacingPopup.hxx +++ b/svx/source/sidebar/text/TextCharacterSpacingPopup.hxx @@ -31,7 +31,7 @@ class TextCharacterSpacingPopup public : TextCharacterSpacingPopup ( vcl::Window* pParent, - const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator); + const ::boost::function<VclPtr<PopupControl>(PopupContainer*)>& rControlCreator); virtual ~TextCharacterSpacingPopup (void); void Rearrange (bool bLBAvailable,bool bAvailable, long nKerning); diff --git a/svx/source/sidebar/text/TextPropertyPanel.cxx b/svx/source/sidebar/text/TextPropertyPanel.cxx index b9b8c26..57ebb7d 100644 --- a/svx/source/sidebar/text/TextPropertyPanel.cxx +++ b/svx/source/sidebar/text/TextPropertyPanel.cxx @@ -43,14 +43,14 @@ const char UNO_UNDERLINE[] = ".uno:Underline"; namespace svx { namespace sidebar { -PopupControl* TextPropertyPanel::CreateCharacterSpacingControl (PopupContainer* pParent) +VclPtr<PopupControl> TextPropertyPanel::CreateCharacterSpacingControl (PopupContainer* pParent) { - return new TextCharacterSpacingControl(pParent, *this, mpBindings); + return VclPtrInstance<TextCharacterSpacingControl>(pParent, *this, mpBindings); } -PopupControl* TextPropertyPanel::CreateUnderlinePopupControl (PopupContainer* pParent) +VclPtr<PopupControl> TextPropertyPanel::CreateUnderlinePopupControl (PopupContainer* pParent) { - return new TextUnderlineControl(pParent, *this, mpBindings); + return VclPtrInstance<TextUnderlineControl>(pParent, *this, mpBindings); } long TextPropertyPanel::GetSelFontSize() @@ -62,7 +62,7 @@ long TextPropertyPanel::GetSelFontSize() return nH; } -TextPropertyPanel* TextPropertyPanel::Create ( +VclPtr<vcl::Window> TextPropertyPanel::Create ( vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings, @@ -75,11 +75,13 @@ TextPropertyPanel* TextPropertyPanel::Create ( if (pBindings == NULL) throw lang::IllegalArgumentException("no SfxBindings given to TextPropertyPanel::Create", NULL, 2); - return new TextPropertyPanel( - pParent, - rxFrame, - pBindings, - rContext); + return VclPtr< vcl::Window >( + new TextPropertyPanel( + pParent, + rxFrame, + pBindings, + rContext), + SAL_NO_ACQUIRE); } diff --git a/svx/source/sidebar/text/TextPropertyPanel.hxx b/svx/source/sidebar/text/TextPropertyPanel.hxx index a5f295f..ee0abaa 100644 --- a/svx/source/sidebar/text/TextPropertyPanel.hxx +++ b/svx/source/sidebar/text/TextPropertyPanel.hxx @@ -49,7 +49,7 @@ public: virtual ~TextPropertyPanel(); virtual void dispose() SAL_OVERRIDE; - static TextPropertyPanel* Create ( + static VclPtr<vcl::Window> Create ( vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings, @@ -107,8 +107,8 @@ private: const ::sfx2::sidebar::EnumContext& rContext); - PopupControl* CreateCharacterSpacingControl (PopupContainer* pParent); - PopupControl* CreateUnderlinePopupControl (PopupContainer* pParent); + VclPtr<PopupControl> CreateCharacterSpacingControl (PopupContainer* pParent); + VclPtr<PopupControl> CreateUnderlinePopupControl (PopupContainer* pParent); DECL_LINK(SpacingClickHdl, ToolBox*); DECL_LINK(UnderlineClickHdl, ToolBox* ); commit 318dc66b7720b85f3b7fa426743c6cf808168f43 Author: Michael Meeks <michael.me...@collabora.com> Date: Mon Apr 13 21:46:06 2015 +0100 Use the new ::Create template method. Change-Id: I79e15b45769ced44b1679943972f7a71c7df8fca diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx index 30b7afa..e61231e 100644 --- a/vcl/source/opengl/OpenGLContext.cxx +++ b/vcl/source/opengl/OpenGLContext.cxx @@ -1142,7 +1142,7 @@ bool OpenGLContext::initWindow() { if( !m_pChildWindow ) { - m_pChildWindow = VclPtrInstance<SystemChildWindow>(mpWindow, 0, &winData, false); + m_pChildWindow = VclPtr<SystemChildWindow>::Create(mpWindow, 0, &winData, false); } pChildSysData = m_pChildWindow->GetSystemData(); } diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index 8401879..33682e1 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -1623,7 +1623,7 @@ public: aMainWin->SetText("Interactive VCL demo #1"); if (bWidgets) - xWidgets = VclPtrInstance< DemoWidgets > (); + xWidgets = VclPtr< DemoWidgets >::Create (); else if (bPopup) xPopup = VclPtrInstance< DemoPopup> (); else commit 324377ada2513031e211f1d38a842859b6f094a2 Author: Michael Meeks <michael.me...@collabora.com> Date: Mon Apr 13 21:19:21 2015 +0100 VclPtr - add a templatized ::Create method for better readability. Change-Id: I2437198709ba4848d975efd1ebb4df1071c6c8f1 diff --git a/include/vcl/vclptr.hxx b/include/vcl/vclptr.hxx index c4c210b..d97124d 100644 --- a/include/vcl/vclptr.hxx +++ b/include/vcl/vclptr.hxx @@ -125,6 +125,20 @@ public: { } + /** + * A construction helper for VclPtr. Since VclPtr types are created + * with a reference-count of one - to help fit into the existing + * code-flow; this helps us to construct them easily. + * + * For more details on the design please see vcl/README.lifecycle + * + * @param reference_type must be a subclass of vcl::Window + */ + template<typename... Arg> static VclPtr< reference_type > Create(Arg &&... arg) + { + return VclPtr< reference_type >( new reference_type(std::forward<Arg>(arg)...), SAL_NO_ACQUIRE ); + } + /** Probably most common used: handle->someBodyOp(). */ inline reference_type * SAL_CALL operator->() const @@ -224,9 +238,10 @@ public: }; // class VclPtr /** - * A construction helper for VclPtr. Since VclPtr types are created - * with a reference-count of one - to help fit into the existing - * code-flow; this helps us to construct them easily. + * A construction helper for a temporary VclPtr. Since VclPtr types + * are created with a reference-count of one - to help fit into + * the existing code-flow; this helps us to construct them easily. + * see also VclPtr::Create and ScopedVclPtr * * For more details on the design please see vcl/README.lifecycle * @@ -295,6 +310,7 @@ public: VclPtr<reference_type>::disposeAndClear(); assert(VclPtr<reference_type>::get() == nullptr); // make sure there are no lingering references } + private: // Most likely we don't want this default copy-construtor. ScopedVclPtr (const ScopedVclPtr<reference_type> &) SAL_DELETED_FUNCTION; diff --git a/vcl/qa/cppunit/lifecycle.cxx b/vcl/qa/cppunit/lifecycle.cxx index b505088..4a0bebf 100644 --- a/vcl/qa/cppunit/lifecycle.cxx +++ b/vcl/qa/cppunit/lifecycle.cxx @@ -59,7 +59,7 @@ void LifecycleTest::testCast() void LifecycleTest::testVirtualDevice() { - VclPtrInstance< VirtualDevice > pVDev; + VclPtr<VirtualDevice> pVDev = VclPtr< VirtualDevice >::Create(); ScopedVclPtrInstance< VirtualDevice > pVDev2; VclPtrInstance<VirtualDevice> pVDev3; VclPtrInstance<VirtualDevice> pVDev4( 1 ); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits