summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-01-07 10:42:07 +0200
committerMichael Meeks <michael.meeks@collabora.com>2015-04-09 19:58:50 +0100
commit3ad9d2550f922ae7f555ca0753c57907d4d78ab6 (patch)
treee4c49fb42eca8566d9ab56600f4d372f4c2eb748 /vcl
parent09b4246c6aa5e75c89df2961816b0124fea7fd78 (diff)
vcl: make VclPtr<T>(T*) constructor explicit
to make it obvious in the code when we are translating between the reference-counted type and raw pointers, since that is the danger-point Change-Id: I32822432325fa34969e78cccf937e2ccbe1bfb70
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/control/combobox.cxx4
-rw-r--r--vcl/source/control/spinfld.cxx14
-rw-r--r--vcl/source/window/builder.cxx4
-rw-r--r--vcl/source/window/dialog.cxx4
-rw-r--r--vcl/source/window/layout.cxx21
5 files changed, 27 insertions, 20 deletions
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 4a4de5cd842d..d84797564a68 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -80,7 +80,7 @@ ComboBox::~ComboBox()
void ComboBox::ImplInitComboBoxData()
{
- mpSubEdit = NULL;
+ mpSubEdit.disposeAndClear();
mpBtn = NULL;
mpImplLB = NULL;
mpFloatWin = NULL;
@@ -164,7 +164,7 @@ void ComboBox::ImplInit( vcl::Window* pParent, WinBits nStyle )
}
}
- mpSubEdit = new Edit( this, nEditStyle );
+ mpSubEdit.set( new Edit( this, nEditStyle ) );
mpSubEdit->EnableRTL( false );
SetSubEdit( mpSubEdit );
mpSubEdit->SetPosPixel( Point() );
diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx
index 85aa37b07769..048f2f4f281c 100644
--- a/vcl/source/control/spinfld.cxx
+++ b/vcl/source/control/spinfld.cxx
@@ -286,7 +286,7 @@ void ImplDrawSpinButton( OutputDevice* pOutDev,
void SpinField::ImplInitSpinFieldData()
{
- mpEdit = NULL;
+ mpEdit.disposeAndClear();
mbSpin = false;
mbRepeat = false;
mbUpperIn = false;
@@ -311,11 +311,11 @@ void SpinField::ImplInit( vcl::Window* pParent, WinBits nWinStyle )
if ( (nWinStyle & WB_SPIN) && ImplUseNativeBorder( nWinStyle ) )
{
SetBackground();
- mpEdit = new Edit( this, WB_NOBORDER );
+ mpEdit.set( new Edit( this, WB_NOBORDER ) );
mpEdit->SetBackground();
}
else
- mpEdit = new Edit( this, WB_NOBORDER );
+ mpEdit.set( new Edit( this, WB_NOBORDER ) );
mpEdit->EnableRTL( false );
mpEdit->SetPosPixel( Point() );
@@ -359,7 +359,13 @@ SpinField::SpinField( vcl::Window* pParent, const ResId& rResId ) :
SpinField::~SpinField()
{
- delete mpEdit;
+ dispose();
+}
+
+void SpinField::dispose()
+{
+ mpEdit.disposeAndClear();
+ Edit::dispose();
}
void SpinField::Up()
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index f7de2d12130a..7efe07eefbe7 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -2093,14 +2093,14 @@ void VclBuilder::handleChild(vcl::Window *pParent, xmlreader::XmlReader &reader)
if (sInternalChild.startsWith("vbox") || sInternalChild.startsWith("messagedialog-vbox"))
{
if (Dialog *pBoxParent = dynamic_cast<Dialog*>(pParent))
- pBoxParent->set_content_area(static_cast<VclBox*>(pCurrentChild));
+ pBoxParent->set_content_area(VclPtr<VclBox>(static_cast<VclBox*>(pCurrentChild))); // FIXME-VCLPTR
}
else if (sInternalChild.startsWith("action_area") || sInternalChild.startsWith("messagedialog-action_area"))
{
vcl::Window *pContentArea = pCurrentChild->GetParent();
if (Dialog *pBoxParent = dynamic_cast<Dialog*>(pContentArea ? pContentArea->GetParent() : NULL))
{
- pBoxParent->set_action_area(static_cast<VclButtonBox*>(pCurrentChild));
+ pBoxParent->set_action_area(VclPtr<VclButtonBox>(static_cast<VclButtonBox*>(pCurrentChild))); // FIXME-VCLPTR
}
}
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 771563f1a536..b5f7b5361f12 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -347,8 +347,8 @@ void Dialog::ImplInitDialogData()
mbOldSaveBack = false;
mbInClose = false;
mbModalMode = false;
- mpContentArea = NULL;
- mpActionArea = NULL;
+ mpContentArea.disposeAndClear();
+ mpActionArea.disposeAndClear();
mnMousePositioned = 0;
mpDialogImpl = new DialogImpl;
}
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index d79abdee7575..ad2cb670a9ed 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -1939,10 +1939,10 @@ bool VclSizeGroup::set_property(const OString &rKey, const OString &rValue)
void MessageDialog::create_owned_areas()
{
set_border_width(12);
- m_pOwnedContentArea = new VclVBox(this, false, 24);
+ m_pOwnedContentArea.set(new VclVBox(this, false, 24));
set_content_area(m_pOwnedContentArea);
m_pOwnedContentArea->Show();
- m_pOwnedActionArea = new VclHButtonBox(m_pOwnedContentArea);
+ m_pOwnedActionArea.set( new VclHButtonBox(m_pOwnedContentArea) );
set_action_area(m_pOwnedActionArea);
m_pOwnedActionArea->Show();
}
@@ -2105,7 +2105,7 @@ short MessageDialog::Execute()
VclContainer *pContainer = get_content_area();
assert(pContainer);
- m_pGrid = new VclGrid(pContainer);
+ m_pGrid.set( new VclGrid(pContainer) );
m_pGrid->reorderWithinParent(0);
m_pGrid->set_column_spacing(12);
m_pGrid->set_row_spacing(GetTextHeight());
@@ -2165,32 +2165,33 @@ short MessageDialog::Execute()
case VCL_BUTTONS_NONE:
break;
case VCL_BUTTONS_OK:
- pBtn = new OKButton(pButtonBox);
+ pBtn.set( new OKButton(pButtonBox) );
pBtn->SetStyle(pBtn->GetStyle() & WB_DEFBUTTON);
pBtn->Show();
m_aOwnedButtons.push_back(pBtn);
m_aResponses[pBtn] = RET_OK;
break;
case VCL_BUTTONS_CLOSE:
- pBtn = new CloseButton(pButtonBox);
+ pBtn.set( new CloseButton(pButtonBox) );
pBtn->SetStyle(pBtn->GetStyle() & WB_DEFBUTTON);
pBtn->Show();
m_aOwnedButtons.push_back(pBtn);
m_aResponses[pBtn] = RET_CLOSE;
break;
case VCL_BUTTONS_CANCEL:
- pBtn = new CancelButton(pButtonBox);
+ pBtn.set( new CancelButton(pButtonBox) );
pBtn->SetStyle(pBtn->GetStyle() & WB_DEFBUTTON);
m_aOwnedButtons.push_back(pBtn);
m_aResponses[pBtn] = RET_CANCEL;
break;
case VCL_BUTTONS_YES_NO:
pBtn = new PushButton(pButtonBox);
- pBtn->SetText(Button::GetStandardText(StandardButtonType::Yes) pBtn->Show();
+ pBtn->SetText(Button::GetStandardText(StandardButtonType::Yes));
+ pBtn->Show();
m_aOwnedButtons.push_back(pBtn);
m_aResponses[pBtn] = RET_YES;
- pBtn = new PushButton(pButtonBox);
+ pBtn.set( new PushButton(pButtonBox) );
pBtn->SetStyle(pBtn->GetStyle() & WB_DEFBUTTON);
pBtn->SetText(Button::GetStandardText(StandardButtonType::No));
pBtn->Show();
@@ -2198,12 +2199,12 @@ short MessageDialog::Execute()
m_aResponses[pBtn] = RET_NO;
break;
case VCL_BUTTONS_OK_CANCEL:
- pBtn = new OKButton(pButtonBox);
+ pBtn.set( new OKButton(pButtonBox) );
pBtn->Show();
m_aOwnedButtons.push_back(pBtn);
m_aResponses[pBtn] = RET_OK;
- pBtn = new CancelButton(pButtonBox);
+ pBtn.set( new CancelButton(pButtonBox) );
pBtn->SetStyle(pBtn->GetStyle() & WB_DEFBUTTON);
pBtn->Show();
m_aOwnedButtons.push_back(pBtn);