[Libreoffice-commits] core.git: Branch 'feature/vclptr' - 4 commits - avmedia/source sc/source sd/source sfx2/source svtools/source toolkit/source vcl/source
Michael Meeks
michael.meeks at collabora.com
Fri Apr 10 03:55:51 PDT 2015
avmedia/source/viewer/mediawindow.cxx | 1 +
avmedia/source/viewer/mediawindow_impl.cxx | 2 ++
sc/source/ui/app/inputwin.cxx | 4 +---
sc/source/ui/view/tabview5.cxx | 10 +++++++++-
sd/source/ui/view/ViewShellBase.cxx | 4 ++--
sd/source/ui/view/ViewTabBar.cxx | 4 ++--
sd/source/ui/view/drviewsa.cxx | 2 ++
sd/source/ui/view/viewshel.cxx | 10 ++++++++--
sfx2/source/view/viewfrm.cxx | 1 -
svtools/source/control/tabbar.cxx | 14 +++++---------
toolkit/source/helper/unowrapper.cxx | 28 +++++++++++++++-------------
vcl/source/control/edit.cxx | 1 +
vcl/source/window/toolbox2.cxx | 2 +-
vcl/source/window/window2.cxx | 3 ++-
14 files changed, 51 insertions(+), 35 deletions(-)
New commits:
commit 4f72ab022425318b109e52a641e63f673fce653d
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Wed Mar 18 16:40:54 2015 +0000
nail more lifecycle oddness.
Change-Id: Ibc29b488cf5077f1d5eb996a8d88dfd057de8266
diff --git a/avmedia/source/viewer/mediawindow.cxx b/avmedia/source/viewer/mediawindow.cxx
index 6444303..fcaf4f3 100644
--- a/avmedia/source/viewer/mediawindow.cxx
+++ b/avmedia/source/viewer/mediawindow.cxx
@@ -330,6 +330,7 @@ void MediaWindow::executeFormatErrorBox( vcl::Window* pParent )
VclPtr<MessageDialog> aErrBox(new MessageDialog( pParent, AVMEDIA_RESID( AVMEDIA_STR_ERR_URL ) ) );
aErrBox->Execute();
+ aErrBox.disposeAndClear();
}
diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx
index 0b5638d..a01d9c4 100644
--- a/sc/source/ui/view/tabview5.cxx
+++ b/sc/source/ui/view/tabview5.cxx
@@ -176,7 +176,7 @@ ScTabView::~ScTabView()
delete pSelEngine;
// Delete this before the grid windows, since it's a child window of one of them.
- mpInputHintWindow.reset();
+ mpInputHintWindow.disposeAndClear();
for (i=0; i<4; i++)
pGridWin[i].disposeAndClear();
@@ -190,6 +190,14 @@ ScTabView::~ScTabView()
pRowOutline[i].disposeAndClear();
}
+ aScrollBarBox.disposeAndClear();
+ aCornerButton.disposeAndClear();
+ aTopButton.disposeAndClear();
+ aHScrollLeft.disposeAndClear();
+ aHScrollRight.disposeAndClear();
+ aVScrollTop.disposeAndClear();
+ aVScrollBottom.disposeAndClear();
+
pHSplitter.disposeAndClear();
pVSplitter.disposeAndClear();
pTabControl.disposeAndClear();
diff --git a/sd/source/ui/view/ViewTabBar.cxx b/sd/source/ui/view/ViewTabBar.cxx
index 1cc8aba..05deb3e 100644
--- a/sd/source/ui/view/ViewTabBar.cxx
+++ b/sd/source/ui/view/ViewTabBar.cxx
@@ -167,8 +167,8 @@ void ViewTabBar::disposing (void)
// Set all references to the one tab page to NULL and delete the page.
for (sal_uInt16 nIndex=0; nIndex<mpTabControl->GetPageCount(); ++nIndex)
mpTabControl->SetTabPage(nIndex, NULL);
- mpTabPage.reset();
- mpTabControl.reset();
+ mpTabPage.disposeAndClear();
+ mpTabControl.disposeAndClear();
}
mxController = NULL;
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 63511fd..4ab221f 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -2786,6 +2786,7 @@ Size Edit::GetMinimumEditSize()
vcl::Window* pDefWin = ImplGetDefaultWindow();
VclPtr<Edit> aEdit(new Edit( pDefWin, WB_BORDER ) );
Size aSize( aEdit->CalcMinimumSize() );
+ aEdit.disposeAndClear();
return aSize;
}
commit 4f386d07474790648843665cac42879cb33eba48
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Wed Mar 18 14:23:09 2015 +0000
more lifecycle cleanup & fixing.
Change-Id: Icc9051bad16c0e66c9e9f631c487a2facde72e9f
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 4cddaa3..0c4c042 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -288,11 +288,9 @@ void ScInputWindow::dispose()
SfxImageManager::GetImageManager( *SC_MOD() )->ReleaseToolBox( this );
+ pRuntimeWindow.disposeAndClear();
aWndPos.disposeAndClear();
- pRuntimeWindow.reset();
-
- pRuntimeWindow.disposeAndClear();
ToolBox::dispose();
}
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 3ab9d13a..42f1811 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -1477,7 +1477,6 @@ SfxViewFrame::SfxViewFrame
SfxViewFrame::~SfxViewFrame()
{
-
SetDowning_Impl();
if ( SfxViewFrame::Current() == this )
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 0378a20..574705a 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -165,7 +165,7 @@ ImplToolItem::ImplToolItem( const ImplToolItem& rItem ) :
ImplToolItem::~ImplToolItem()
{
- mpWindow.disposeAndClear();
+ // don't dispose mpWindow - we get copied around.
}
ImplToolItem& ImplToolItem::operator=( const ImplToolItem& rItem )
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index 25b599b..95468f3 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -1346,7 +1346,8 @@ void Window::SetHelpText( const OUString& rHelpText )
void Window::SetQuickHelpText( const OUString& rHelpText )
{
- mpWindowImpl->maQuickHelpText = rHelpText;
+ if (mpWindowImpl)
+ mpWindowImpl->maQuickHelpText = rHelpText;
}
const OUString& Window::GetQuickHelpText() const
commit 739f3a5c2b5410685b22d920e8d6c4d59567dfd3
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Wed Mar 18 13:51:37 2015 +0000
mend misc. lifecycle breakage.
Change-Id: I6e960db9659f5122a45c4cf173e680bb782acf76
diff --git a/avmedia/source/viewer/mediawindow_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx
index 5ff2f06..4d5eaa4 100644
--- a/avmedia/source/viewer/mediawindow_impl.cxx
+++ b/avmedia/source/viewer/mediawindow_impl.cxx
@@ -508,12 +508,14 @@ void MediaWindowImpl::onURLChanged()
{
if( m_sMimeType == AVMEDIA_MIMETYPE_COMMON )
{
+ mpChildWindow.disposeAndClear();
mpChildWindow.reset(new MediaChildWindow(this) );
}
#if HAVE_FEATURE_GLTF
else if ( m_sMimeType == AVMEDIA_MIMETYPE_JSON )
{
SystemWindowData aWinData = OpenGLContext::generateWinData(this, false);
+ mpChildWindow.disposeAndClear();
mpChildWindow.reset(new MediaChildWindow(this,&aWinData));
mbEventTransparent = false;
}
diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx
index bba59e83..03ba2b1 100644
--- a/sd/source/ui/view/ViewShellBase.cxx
+++ b/sd/source/ui/view/ViewShellBase.cxx
@@ -240,7 +240,7 @@ ViewShellBase::ViewShellBase (
mpDocument (NULL)
{
mpImpl.reset(new Implementation(*this));
- mpImpl->mpViewWindow.reset(new FocusForwardingWindow(_pFrame->GetWindow(),*this));
+ mpImpl->mpViewWindow = new FocusForwardingWindow(_pFrame->GetWindow(),*this);
mpImpl->mpViewWindow->SetBackground(Wallpaper());
_pFrame->GetWindow().SetBackground(Application::GetSettings().GetStyleSettings().GetLightColor());
@@ -1028,7 +1028,7 @@ ViewShellBase::Implementation::~Implementation (void)
{
mpController = NULL;
mpViewTabBar = NULL;
- mpViewWindow.reset();
+ mpViewWindow.disposeAndClear();
mpToolBarManager.reset();
}
diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx
index 2f08b03..b42b71f 100644
--- a/sd/source/ui/view/drviewsa.cxx
+++ b/sd/source/ui/view/drviewsa.cxx
@@ -191,6 +191,8 @@ DrawViewShell::~DrawViewShell()
mpFrameView->Disconnect();
delete [] mpSlotArray;
+
+ maTabControl.disposeAndClear();
}
/**
diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx
index 4076a09..c4b6f4f 100644
--- a/sd/source/ui/view/viewshel.cxx
+++ b/sd/source/ui/view/viewshel.cxx
@@ -151,7 +151,7 @@ ViewShell::~ViewShell()
delete mpZoomList;
- mpLayerTabBar.reset();
+ mpLayerTabBar.disposeAndClear();
if (mpImpl->mpSubShellFactory.get() != NULL)
GetViewShellBase().GetViewShellManager()->RemoveSubShellFactory(
@@ -163,8 +163,14 @@ ViewShell::~ViewShell()
"sd.ui",
"destroying mpContentWindow at " << mpContentWindow.get()
<< " with parent " << mpContentWindow->GetParent());
- mpContentWindow.reset();
+ mpContentWindow.disposeAndClear();
}
+
+ mpScrollBarBox.disposeAndClear();
+ mpVerticalRuler.disposeAndClear();
+ mpHorizontalRuler.disposeAndClear();
+ mpVerticalScrollBar.disposeAndClear();
+ mpHorizontalScrollBar.disposeAndClear();
}
/**
diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx
index 8fd29e4..2df93f1 100644
--- a/svtools/source/control/tabbar.cxx
+++ b/svtools/source/control/tabbar.cxx
@@ -338,15 +338,7 @@ struct TabBar_Impl
svt::AccessibleFactoryAccess maAccessibleFactory;
- TabBar_Impl()
- : mpSizer()
- , mpFirstButton()
- , mpPrevButton()
- , mpNextButton()
- , mpLastButton()
- , mpEdit()
- , mpItemList()
- {}
+ TabBar_Impl() {}
~TabBar_Impl()
{
@@ -367,6 +359,10 @@ struct TabBar_Impl
{
return static_cast<sal_uInt16>(mpItemList.size());
}
+ ~TabBar_Impl()
+ {
+ mpSizer.disposeAndClear();
+ }
};
TabBar::TabBar( vcl::Window* pParent, WinBits nWinStyle ) :
commit f583322c079c4bbc4be21ee3ba5d1d1b91c3d061
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Wed Mar 18 12:55:27 2015 +0000
toolkit: much safer WindowDestroyed handler.
Change-Id: I0c72231a932186130246bab343653ecb563a41f2
diff --git a/toolkit/source/helper/unowrapper.cxx b/toolkit/source/helper/unowrapper.cxx
index 6087476..fd2d33c 100644
--- a/toolkit/source/helper/unowrapper.cxx
+++ b/toolkit/source/helper/unowrapper.cxx
@@ -219,13 +219,13 @@ void UnoWrapper::WindowDestroyed( vcl::Window* pWindow )
{
// their still might be some children created with ::com::sun::star::loader::Java
// that would otherwise not be destroyed until the garbage collector cleans up
- vcl::Window* pChild = pWindow->GetWindow( WINDOW_FIRSTCHILD );
+ VclPtr< vcl::Window > pChild = pWindow->GetWindow( WINDOW_FIRSTCHILD );
while ( pChild )
{
- vcl::Window* pNextChild = pChild->GetWindow( WINDOW_NEXT );
+ VclPtr< vcl::Window > pNextChild = pChild->GetWindow( WINDOW_NEXT );
- vcl::Window* pClient = pChild->GetWindow( WINDOW_CLIENT );
- if ( pClient->GetWindowPeer() )
+ VclPtr< vcl::Window > pClient = pChild->GetWindow( WINDOW_CLIENT );
+ if ( pClient && pClient->GetWindowPeer() )
{
::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xComp( pClient->GetComponentInterface( false ), ::com::sun::star::uno::UNO_QUERY );
xComp->dispose();
@@ -235,16 +235,16 @@ void UnoWrapper::WindowDestroyed( vcl::Window* pWindow )
}
// System-Windows suchen...
- vcl::Window* pOverlap = pWindow->GetWindow( WINDOW_OVERLAP );
+ VclPtr< vcl::Window > pOverlap = pWindow->GetWindow( WINDOW_OVERLAP );
if ( pOverlap )
{
pOverlap = pOverlap->GetWindow( WINDOW_FIRSTOVERLAP );
while ( pOverlap )
{
- vcl::Window* pNextOverlap = pOverlap->GetWindow( WINDOW_NEXT );
- vcl::Window* pClient = pOverlap->GetWindow( WINDOW_CLIENT );
+ VclPtr< vcl::Window > pNextOverlap = pOverlap->GetWindow( WINDOW_NEXT );
+ VclPtr< vcl::Window > pClient = pOverlap->GetWindow( WINDOW_CLIENT );
- if ( pClient->GetWindowPeer() && lcl_ImplIsParent( pWindow, pClient ) )
+ if ( pClient && pClient->GetWindowPeer() && lcl_ImplIsParent( pWindow, pClient ) )
{
::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xComp( pClient->GetComponentInterface( false ), ::com::sun::star::uno::UNO_QUERY );
xComp->dispose();
@@ -254,9 +254,11 @@ void UnoWrapper::WindowDestroyed( vcl::Window* pWindow )
}
}
- vcl::Window* pParent = pWindow->GetParent();
- if ( pParent && pParent->GetWindowPeer() )
- pParent->GetWindowPeer()->notifyWindowRemoved( *pWindow );
+ {
+ VclPtr< vcl::Window > pParent = pWindow->GetParent();
+ if ( pParent && pParent->GetWindowPeer() )
+ pParent->GetWindowPeer()->notifyWindowRemoved( *pWindow );
+ }
VCLXWindow* pWindowPeer = pWindow->GetWindowPeer();
uno::Reference< lang::XComponent > xWindowPeerComp( pWindow->GetComponentInterface( false ), uno::UNO_QUERY );
@@ -276,13 +278,13 @@ void UnoWrapper::WindowDestroyed( vcl::Window* pWindow )
// #i42462#/#116855# no, don't loop: Instead, just ensure that all our top-window-children
// are disposed, too (which should also be a valid fix for #102132#, but doesn't have the extreme
// performance penalties)
- vcl::Window* pTopWindowChild = pWindow->GetWindow( WINDOW_FIRSTTOPWINDOWCHILD );
+ VclPtr< vcl::Window > pTopWindowChild = pWindow->GetWindow( WINDOW_FIRSTTOPWINDOWCHILD );
while ( pTopWindowChild )
{
OSL_ENSURE( pTopWindowChild->GetParent() == pWindow,
"UnoWrapper::WindowDestroyed: inconsistency in the SystemWindow relationship!" );
- vcl::Window* pNextTopChild = pTopWindowChild->GetWindow( WINDOW_NEXTTOPWINDOWSIBLING );
+ VclPtr< vcl::Window > pNextTopChild = pTopWindowChild->GetWindow( WINDOW_NEXTTOPWINDOWSIBLING );
//the window still could be on the stack, so we have to
// use lazy delete ( it will automatically
More information about the Libreoffice-commits
mailing list