summaryrefslogtreecommitdiff
path: root/vcl/source/window
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2015-03-30 17:49:20 +0100
committerMichael Meeks <michael.meeks@collabora.com>2015-04-10 13:13:53 +0100
commit582e89610b366c0d887baa6b8de7fa5f065900fa (patch)
tree91f3b723d1485b5616d457e30011fa55914785a4 /vcl/source/window
parent49dadad0b55f879ebe5daf539a97043d283ad0a8 (diff)
vclptr: create Instance helpers, and set initial ref-count to 1.
Document that in README.lifecycle; the problem is that our constructors currently take and release references left/right on the object being created, which ... means we need an initial reference. Change-Id: I5de952b73ac67888c3fbb150d4a7cde2a7bc9abf
Diffstat (limited to 'vcl/source/window')
-rw-r--r--vcl/source/window/dialog.cxx2
-rw-r--r--vcl/source/window/menubarwindow.cxx2
-rw-r--r--vcl/source/window/paint.cxx2
-rw-r--r--vcl/source/window/printdlg.cxx6
-rw-r--r--vcl/source/window/toolbox.cxx2
5 files changed, 7 insertions, 7 deletions
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 9ca9c30a1b40..e59ba305a80a 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -1065,7 +1065,7 @@ void Dialog::GrabFocusToFirstControl()
void Dialog::GetDrawWindowBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder, sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const
{
- ScopedVclPtr<ImplBorderWindow> aImplWin( new ImplBorderWindow( (vcl::Window*)this, WB_BORDER|WB_STDWORK, BORDERWINDOW_STYLE_OVERLAP ) );
+ ScopedVclPtrInstance<ImplBorderWindow> aImplWin( (vcl::Window*)this, WB_BORDER|WB_STDWORK, BORDERWINDOW_STYLE_OVERLAP );
aImplWin->GetBorder( rLeftBorder, rTopBorder, rRightBorder, rBottomBorder );
}
diff --git a/vcl/source/window/menubarwindow.cxx b/vcl/source/window/menubarwindow.cxx
index 0f49c51e78b0..7c0bca777f06 100644
--- a/vcl/source/window/menubarwindow.cxx
+++ b/vcl/source/window/menubarwindow.cxx
@@ -60,7 +60,7 @@ void DecoToolBox::DataChanged( const DataChangedEvent& rDCEvt )
void DecoToolBox::calcMinSize()
{
- ScopedVclPtr<ToolBox> aTbx( new ToolBox(GetParent()) );
+ ScopedVclPtrInstance<ToolBox> aTbx( GetParent() );
if( GetItemCount() == 0 )
{
ResMgr* pResMgr = ImplGetResMgr();
diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx
index 0f05ded46af0..1dd9b3a50e98 100644
--- a/vcl/source/window/paint.cxx
+++ b/vcl/source/window/paint.cxx
@@ -1094,7 +1094,7 @@ void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rP
mpWindowImpl->mbReallyVisible = bRVisible;
// paint metafile to VDev
- VclPtr<VirtualDevice> pMaskedDevice = new VirtualDevice( *i_pTargetOutDev, 0, 0 );
+ VclPtrInstance<VirtualDevice> pMaskedDevice( *i_pTargetOutDev, 0, 0 );
pMaskedDevice->SetOutputSizePixel( GetOutputSizePixel() );
pMaskedDevice->EnableRTL( IsRTLEnabled() );
aMtf.WindStart();
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index 4ab06b61049c..f173ad36915d 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -624,13 +624,13 @@ PrintDialog::PrintDialog( vcl::Window* i_pParent, const std::shared_ptr<PrinterC
if( maJobPage.mpPrinters->GetEntryPos( aValue ) != LISTBOX_ENTRY_NOTFOUND )
{
maJobPage.mpPrinters->SelectEntry( aValue );
- maPController->setPrinter( VclPtr<Printer>( new Printer( aValue ) ) );
+ maPController->setPrinter( VclPtrInstance<Printer>( aValue ) );
}
else
{
// fall back to default printer
maJobPage.mpPrinters->SelectEntry( Printer::GetDefaultPrinterName() );
- maPController->setPrinter( VclPtr<Printer>( new Printer( Printer::GetDefaultPrinterName() ) ) );
+ maPController->setPrinter( VclPtrInstance<Printer>( Printer::GetDefaultPrinterName() ) );
}
}
// not printing to file
@@ -1521,7 +1521,7 @@ IMPL_LINK( PrintDialog, SelectHdl, ListBox*, pBox )
{
OUString aNewPrinter( pBox->GetSelectEntry() );
// set new printer
- maPController->setPrinter( VclPtr<Printer>( new Printer( aNewPrinter ) ) );
+ maPController->setPrinter( VclPtrInstance<Printer>( aNewPrinter ) );
maPController->resetPrinterOptions( maOptionsPage.mpToFileBox->IsChecked() );
// update text fields
updatePrinterText();
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 58ec9241039a..b434061fb274 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -4833,7 +4833,7 @@ Size ToolBox::CalcMinimumWindowSizePixel() const
else
{
// create dummy toolbox for measurements
- VclPtr< ToolBox > pToolBox = new ToolBox( GetParent(), GetStyle() );
+ VclPtrInstance< ToolBox > pToolBox( GetParent(), GetStyle() );
// copy until first useful item
std::vector< ImplToolItem >::iterator it = mpData->m_aItems.begin();