summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-03-18 08:33:14 +0200
committerMichael Meeks <michael.meeks@collabora.com>2015-04-10 11:59:25 +0100
commit0556598b35eb6d81fdaff04520f14202660f0333 (patch)
tree2fb64309bbd8e519f25b1e55824bad5513754e91 /vcl
parent7aa921cb53eedd0a107fbe9f75365adcce4d37d9 (diff)
vclwidget: check for calling delete on subclasses of vcl::Window
Change-Id: I7fb7cf919e3f46dd03a18b1cb95fa881915f9642
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/app/help.cxx8
-rw-r--r--vcl/source/outdev/map.cxx4
-rw-r--r--vcl/source/uipreviewer/previewer.cxx4
-rw-r--r--vcl/source/window/builder.cxx4
-rw-r--r--vcl/source/window/dockmgr.cxx7
-rw-r--r--vcl/source/window/dockwin.cxx4
-rw-r--r--vcl/source/window/window.cxx4
7 files changed, 17 insertions, 18 deletions
diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx
index 50151aca4865..c13acfa7e113 100644
--- a/vcl/source/app/help.cxx
+++ b/vcl/source/app/help.cxx
@@ -229,12 +229,12 @@ void Help::UpdateTip( sal_uIntPtr nId, vcl::Window* pParent, const Rectangle& rS
void Help::HideTip( sal_uLong nId )
{
- HelpTextWindow* pHelpWin = reinterpret_cast<HelpTextWindow*>(nId);
+ VclPtr<HelpTextWindow> pHelpWin = reinterpret_cast<HelpTextWindow*>(nId);
vcl::Window* pFrameWindow = pHelpWin->ImplGetFrameWindow();
pHelpWin->Hide();
// trigger update, so that a Paint is instantly triggered since we do not save the background
pFrameWindow->ImplUpdateAll();
- delete pHelpWin;
+ pHelpWin.disposeAndClear();
ImplGetSVData()->maHelpData.mnLastHelpHideTime = tools::Time::GetSystemTicks();
}
@@ -550,7 +550,7 @@ void ImplShowHelpWindow( vcl::Window* pParent, sal_uInt16 nHelpWinStyle, sal_uIn
void ImplDestroyHelpWindow( bool bUpdateHideTime )
{
ImplSVData* pSVData = ImplGetSVData();
- HelpTextWindow* pHelpWin = pSVData->maHelpData.mpHelpWin;
+ VclPtr<HelpTextWindow> pHelpWin = pSVData->maHelpData.mpHelpWin;
if ( pHelpWin )
{
vcl::Window * pWindow = pHelpWin->GetParent()->ImplGetFrameWindow();
@@ -561,7 +561,7 @@ void ImplDestroyHelpWindow( bool bUpdateHideTime )
pSVData->maHelpData.mpHelpWin = NULL;
pSVData->maHelpData.mbKeyboardHelp = false;
pHelpWin->Hide();
- delete pHelpWin;
+ pHelpWin.disposeAndClear();
if( bUpdateHideTime )
pSVData->maHelpData.mnLastHelpHideTime = tools::Time::GetSystemTicks();
}
diff --git a/vcl/source/outdev/map.cxx b/vcl/source/outdev/map.cxx
index b359e504d0a9..a1aa6c128a9d 100644
--- a/vcl/source/outdev/map.cxx
+++ b/vcl/source/outdev/map.cxx
@@ -232,9 +232,9 @@ static void ImplCalcMapResolution( const MapMode& rMapMode,
vcl::Window::ImplInitAppFontData( pSVData->maWinData.mpFirstFrame );
else
{
- WorkWindow* pWin = new WorkWindow( NULL, 0 );
+ VclPtr<WorkWindow> pWin = new WorkWindow( NULL, 0 );
vcl::Window::ImplInitAppFontData( pWin );
- delete pWin;
+ pWin.disposeAndClear();
}
}
rMapRes.mnMapScNumX = pSVData->maGDIData.mnAppFontX;
diff --git a/vcl/source/uipreviewer/previewer.cxx b/vcl/source/uipreviewer/previewer.cxx
index e889e78f8644..20074297e5a5 100644
--- a/vcl/source/uipreviewer/previewer.cxx
+++ b/vcl/source/uipreviewer/previewer.cxx
@@ -68,7 +68,7 @@ int UIPreviewApp::Main()
try
{
- Dialog *pDialog = new Dialog(DIALOG_NO_PARENT, WB_STDDIALOG | WB_SIZEABLE);
+ VclPtr<Dialog> pDialog = new Dialog(DIALOG_NO_PARENT, WB_STDDIALOG | WB_SIZEABLE);
{
VclBuilder aBuilder(pDialog, OUString(), uifiles[0]);
@@ -90,7 +90,7 @@ int UIPreviewApp::Main()
pRealDialog->Execute();
}
- delete pDialog;
+ pDialog.disposeAndClear();
}
catch (const uno::Exception &e)
{
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 275e075a8bd6..92595d061c33 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -3292,10 +3292,10 @@ void VclBuilder::delete_by_name(const OString& sID)
}
}
-void VclBuilder::delete_by_window(const vcl::Window *pWindow)
+void VclBuilder::delete_by_window(vcl::Window *pWindow)
{
drop_ownership(pWindow);
- delete pWindow;
+ VclPtr<vcl::Window>(pWindow).disposeAndClear();
}
void VclBuilder::drop_ownership(const vcl::Window *pWindow)
diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx
index 2010fd9e0e9f..c5726af5bd40 100644
--- a/vcl/source/window/dockmgr.cxx
+++ b/vcl/source/window/dockmgr.cxx
@@ -856,14 +856,14 @@ bool ImplDockingWindowWrapper::ImplStartDocking( const Point& rPos )
mbStartFloat = mbLastFloatMode;
// calculate FloatingBorder
- FloatingWindow* pWin;
+ VclPtr<FloatingWindow> pWin;
if ( mpFloatWin )
pWin = mpFloatWin;
else
pWin = new ImplDockFloatWin2( mpParent, mnFloatBits, NULL );
pWin->GetBorder( mnDockLeft, mnDockTop, mnDockRight, mnDockBottom );
if ( !mpFloatWin )
- delete pWin;
+ pWin.disposeAndClear();
Point aPos = GetWindow()->ImplOutputToFrame( Point() );
Size aSize = GetWindow()->GetOutputSizePixel();
@@ -1299,8 +1299,7 @@ void ImplDockingWindowWrapper::SetFloatingMode( bool bFloatMode )
GetWindow()->SetParent( pRealParent );
GetWindow()->mpWindowImpl->mpRealParent = pRealParent;
- delete static_cast<ImplDockFloatWin2*>(mpFloatWin.get());
- mpFloatWin = NULL;
+ mpFloatWin.disposeAndClear();
GetWindow()->SetPosPixel( maDockPos );
if ( bVisible )
diff --git a/vcl/source/window/dockwin.cxx b/vcl/source/window/dockwin.cxx
index 6ceafc25b9c8..6cc6301730b2 100644
--- a/vcl/source/window/dockwin.cxx
+++ b/vcl/source/window/dockwin.cxx
@@ -264,14 +264,14 @@ bool DockingWindow::ImplStartDocking( const Point& rPos )
mbStartFloat = mbLastFloatMode;
// calculate FloatingBorder
- FloatingWindow* pWin;
+ VclPtr<FloatingWindow> pWin;
if ( mpFloatWin )
pWin = mpFloatWin;
else
pWin = new ImplDockFloatWin( mpImplData->mpParent, mnFloatBits, NULL );
pWin->GetBorder( mnDockLeft, mnDockTop, mnDockRight, mnDockBottom );
if ( !mpFloatWin )
- delete pWin;
+ pWin.disposeAndClear();
Point aPos = ImplOutputToFrame( Point() );
Size aSize = Window::GetOutputSizePixel();
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 61ed19362682..2af94700afce 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -2097,7 +2097,7 @@ void Window::SetBorderStyle( WindowBorderStyle nBorderStyle )
// this is a little awkward: some controls (e.g. svtools ProgressBar)
// cannot avoid getting constructed with WB_BORDER but want to disable
// borders in case of NWF drawing. So they need a method to remove their border window
- vcl::Window* pBorderWin = mpWindowImpl->mpBorderWindow;
+ VclPtr<vcl::Window> pBorderWin = mpWindowImpl->mpBorderWindow;
// remove us as border window's client
pBorderWin->mpWindowImpl->mpClientWindow = NULL;
mpWindowImpl->mpBorderWindow = NULL;
@@ -2109,7 +2109,7 @@ void Window::SetBorderStyle( WindowBorderStyle nBorderStyle )
Size aBorderSize( pBorderWin->GetSizePixel() );
setPosSizePixel( aBorderPos.X(), aBorderPos.Y(), aBorderSize.Width(), aBorderSize.Height() );
// release border window
- delete pBorderWin;
+ pBorderWin.disposeAndClear();
// set new style bits
SetStyle( GetStyle() & (~WB_BORDER) );