include/vcl/dockwin.hxx | 2 +- include/vcl/syswin.hxx | 2 +- vcl/source/window/dialog.cxx | 2 +- vcl/source/window/dockwin.cxx | 8 ++++---- vcl/source/window/syswin.cxx | 2 +- vcl/source/window/toolbox2.cxx | 14 ++++++++------ 6 files changed, 16 insertions(+), 14 deletions(-)
New commits: commit 77cc543a194a1df6664ed7f4931559010d929401 Author: Michael Meeks <[email protected]> Date: Fri Mar 27 14:51:14 2015 +0000 Encourage disposed toolbox items to play nicely. Change-Id: I4a28ba4740e9c84666cd85c046598862f20a7a96 diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index 85c4d68..16a467b9 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -880,7 +880,7 @@ void ToolBox::SetPageScroll( bool b ) sal_uInt16 ToolBox::GetItemCount() const { - return (sal_uInt16)mpData->m_aItems.size(); + return mpData ? (sal_uInt16)mpData->m_aItems.size() : 0; } ToolBoxItemType ToolBox::GetItemType( sal_uInt16 nPos ) const @@ -890,11 +890,13 @@ ToolBoxItemType ToolBox::GetItemType( sal_uInt16 nPos ) const sal_uInt16 ToolBox::GetItemPos( sal_uInt16 nItemId ) const { - int nCount = mpData->m_aItems.size(); - for( int nPos = 0; nPos < nCount; nPos++ ) - if( mpData->m_aItems[nPos].mnId == nItemId ) - return (sal_uInt16)nPos; - + if (mpData) + { + int nCount = mpData->m_aItems.size(); + for( int nPos = 0; nPos < nCount; nPos++ ) + if( mpData->m_aItems[nPos].mnId == nItemId ) + return (sal_uInt16)nPos; + } return TOOLBOX_ITEM_NOTFOUND; } commit a0f96f343ef43a75710e36cc6137a2e63c003eec Author: Michael Meeks <[email protected]> Date: Fri Mar 27 14:36:47 2015 +0000 Unwind mpDialogParent oddness. This pointer is used to pass extra information through dialog constructors, and (as such) if implemented with a VclPtr it causes us to take and then release a reference on our in-construction object, before it can return it's 'this' into the safety of its calling VclPtr<> constructor; not good. cf. Dialog::doDeferredInit vs. SystemWindow::loadUI. Change-Id: Idcab40cedcdebed560077cfaa1a14395e6e01cd6 diff --git a/include/vcl/dockwin.hxx b/include/vcl/dockwin.hxx index 65b78d1..dd9667e 100644 --- a/include/vcl/dockwin.hxx +++ b/include/vcl/dockwin.hxx @@ -264,7 +264,7 @@ private: mbIsCalculatingInitialLayoutSize:1, mbInitialLayoutDone:1; - VclPtr<vcl::Window> mpDialogParent; + vcl::Window *mpDialogParent; // deliberately not a VclPtr SAL_DLLPRIVATE void ImplInitDockingWindowData(); SAL_DLLPRIVATE void setPosSizeOnContainee(Size aSize, Window &rBox); diff --git a/include/vcl/syswin.hxx b/include/vcl/syswin.hxx index d44086f..d30cd42 100644 --- a/include/vcl/syswin.hxx +++ b/include/vcl/syswin.hxx @@ -155,7 +155,7 @@ private: Idle maLayoutIdle; protected: bool mbIsDefferedInit; - VclPtr<vcl::Window> mpDialogParent; + vcl::Window *mpDialogParent; // deliberately not a VclPtr public: using Window::ImplIsInTaskPaneList; SAL_DLLPRIVATE bool ImplIsInTaskPaneList( vcl::Window* pWin ); diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index 8edc7ee..cf4abe8 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -492,7 +492,7 @@ OUString VclBuilderContainer::getUIRootDir() //do the init. Find the real parent stashed in mpDialogParent. void Dialog::doDeferredInit(WinBits nBits) { - VclPtr<vcl::Window> pParent = mpDialogParent; + vcl::Window *pParent = mpDialogParent; mpDialogParent = NULL; ImplInit(pParent, nBits); mbIsDefferedInit = false; diff --git a/vcl/source/window/dockwin.cxx b/vcl/source/window/dockwin.cxx index 3efb65f..359ee13 100644 --- a/vcl/source/window/dockwin.cxx +++ b/vcl/source/window/dockwin.cxx @@ -121,7 +121,7 @@ void ImplDockFloatWin::dispose() disposeBuilder(); - mpDockWin.disposeAndClear(); + mpDockWin.clear(); FloatingWindow::dispose(); } @@ -482,9 +482,9 @@ void DockingWindow::dispose() } delete mpImplData; mpImplData = NULL; - mpFloatWin.disposeAndClear(); - mpOldBorderWin.disposeAndClear(); - mpDialogParent.disposeAndClear(); + mpFloatWin.clear(); + mpOldBorderWin.clear(); + mpDialogParent = NULL; Window::dispose(); } diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx index 9622d85..799ce4a 100644 --- a/vcl/source/window/syswin.cxx +++ b/vcl/source/window/syswin.cxx @@ -117,7 +117,7 @@ void SystemWindow::dispose() disposeBuilder(); - mpDialogParent.disposeAndClear(); + mpDialogParent = NULL; Window::dispose(); } _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
