diff options
author | Noel Grandin <noel@peralex.com> | 2015-03-20 11:27:10 +0200 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-04-10 12:37:44 +0100 |
commit | 61b224f392eb856bf4cfa0c04c68202a463cbdbf (patch) | |
tree | 77a28e38763bc5f9d95e2c278601d31dc6fbf65d /vcl | |
parent | f1d9eef4163e88a3cb6360178b52ce441e65d8ae (diff) |
vclwidget: fixup locally allocated vcl::Window objects
They need to be wrapped in ScopedVclPtr in order to be disposed properly.
Change-Id: Ib64dba353774f54711e4de7f5d15d859c6a4dc7e
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/generic/print/genprnpsp.cxx | 2 | ||||
-rw-r--r-- | vcl/generic/print/prtsetup.cxx | 2 | ||||
-rw-r--r-- | vcl/source/app/dbggui.cxx | 6 | ||||
-rw-r--r-- | vcl/source/app/stdtext.cxx | 2 | ||||
-rw-r--r-- | vcl/source/app/svdata.cxx | 2 | ||||
-rw-r--r-- | vcl/source/control/edit.cxx | 5 | ||||
-rw-r--r-- | vcl/source/gdi/print3.cxx | 6 | ||||
-rw-r--r-- | vcl/source/window/dialog.cxx | 4 | ||||
-rw-r--r-- | vcl/source/window/menubarwindow.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/generic/printer/cupsmgr.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/x11/x11sys.cxx | 2 | ||||
-rw-r--r-- | vcl/workben/outdevgrind.cxx | 2 | ||||
-rw-r--r-- | vcl/workben/svdem.cxx | 2 | ||||
-rw-r--r-- | vcl/workben/svpclient.cxx | 2 | ||||
-rw-r--r-- | vcl/workben/svptest.cxx | 2 | ||||
-rw-r--r-- | vcl/workben/vcldemo.cxx | 2 |
16 files changed, 22 insertions, 23 deletions
diff --git a/vcl/generic/print/genprnpsp.cxx b/vcl/generic/print/genprnpsp.cxx index 1977e2dd9070..689d9315762f 100644 --- a/vcl/generic/print/genprnpsp.cxx +++ b/vcl/generic/print/genprnpsp.cxx @@ -144,7 +144,7 @@ namespace int QueryFaxNumber(OUString& rNumber) { OUString aTmpString(VclResId(SV_PRINT_QUERYFAXNUMBER_TXT)); - VclPtr<QueryString> aQuery(new QueryString(NULL, aTmpString, rNumber)); + ScopedVclPtr<QueryString> aQuery(new QueryString(NULL, aTmpString, rNumber)); return aQuery->Execute(); } } diff --git a/vcl/generic/print/prtsetup.cxx b/vcl/generic/print/prtsetup.cxx index 1603b8e4c1c5..3d34bb1fcdee 100644 --- a/vcl/generic/print/prtsetup.cxx +++ b/vcl/generic/print/prtsetup.cxx @@ -502,7 +502,7 @@ void RTSDevicePage::FillValueBox( const PPDKey* pKey ) int SetupPrinterDriver(::psp::PrinterInfo& rJobData) { int nRet = 0; - VclPtr<RTSDialog> aDialog(new RTSDialog( rJobData, NULL ) ); + ScopedVclPtr<RTSDialog> aDialog(new RTSDialog( rJobData, NULL ) ); if( aDialog->Execute() ) { diff --git a/vcl/source/app/dbggui.cxx b/vcl/source/app/dbggui.cxx index 852220922cda..f3ebc74b2ea0 100644 --- a/vcl/source/app/dbggui.cxx +++ b/vcl/source/app/dbggui.cxx @@ -354,7 +354,7 @@ IMPL_LINK( DbgDialog, ClickHdl, Button*, pButton ) } if( (aData.nTestFlags & ~IMMEDIATE_FLAGS) != (pData->nTestFlags & ~IMMEDIATE_FLAGS) ) { - VclPtr<MessageDialog> aBox(new MessageDialog(this, OUString( + ScopedVclPtr<MessageDialog> aBox(new MessageDialog(this, OUString( "Some of the changed settings will only be active after " "restarting the process"), VCL_MESSAGE_INFO)); aBox->Execute(); @@ -369,7 +369,7 @@ void DbgDialog::RequestHelp( const HelpEvent& rHEvt ) { if ( rHEvt.GetMode() & HelpEventMode::CONTEXT ) { - VclPtr<DbgInfoDialog> aInfoDialog(new DbgInfoDialog( this, true ) ); + ScopedVclPtr<DbgInfoDialog> aInfoDialog(new DbgInfoDialog( this, true ) ); OUString aHelpText; const sal_Char** pHelpStrs = pDbgHelpText; while ( *pHelpStrs ) @@ -833,7 +833,7 @@ void DbgGUIStart() if ( pData ) { - VclPtr<DbgDialog> pDialog(new DbgDialog); + ScopedVclPtr<DbgDialog> pDialog(new DbgDialog); // we switch off dialog tests for the debug dialog sal_uLong nOldFlags = pData->nTestFlags; pData->nTestFlags &= ~DBG_TEST_DIALOG; diff --git a/vcl/source/app/stdtext.cxx b/vcl/source/app/stdtext.cxx index ca3ee6bbc566..dcd8c9e69ffb 100644 --- a/vcl/source/app/stdtext.cxx +++ b/vcl/source/app/stdtext.cxx @@ -39,7 +39,7 @@ void ShowServiceNotAvailableError(vcl::Window* pParent, { OUString aText = GetStandardText(STANDARD_TEXT_SERVICE_NOT_AVAILABLE). replaceAll("%s", rServiceName); - VclPtr<MessageDialog> aBox(new MessageDialog(pParent, aText, bError ? VCL_MESSAGE_ERROR : VCL_MESSAGE_WARNING)); + ScopedVclPtr<MessageDialog> aBox(new MessageDialog(pParent, aText, bError ? VCL_MESSAGE_ERROR : VCL_MESSAGE_WARNING)); aBox->Execute(); } diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx index bd33350e7a10..b8563c518654 100644 --- a/vcl/source/app/svdata.cxx +++ b/vcl/source/app/svdata.cxx @@ -172,7 +172,7 @@ ResMgr* ImplGetResMgr() "Missing vcl resource. This indicates that files vital to localization are missing. " "You might have a corrupt installation."; fprintf( stderr, "%s\n", pMsg ); - VclPtr<MessageDialog> aBox(new MessageDialog(NULL, OUString(pMsg, strlen(pMsg), RTL_TEXTENCODING_ASCII_US))); + ScopedVclPtr<MessageDialog> aBox(new MessageDialog(NULL, OUString(pMsg, strlen(pMsg), RTL_TEXTENCODING_ASCII_US))); aBox->Execute(); } } diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index 4ab221fccc07..246df6ee6e75 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -805,7 +805,7 @@ void Edit::ShowTruncationWarning( vcl::Window* pParent ) ResMgr* pResMgr = ImplGetResMgr(); if( pResMgr ) { - VclPtr<MessageDialog> aBox(new MessageDialog(pParent, ResId(SV_EDIT_WARNING_STR, *pResMgr), VCL_MESSAGE_WARNING)); + ScopedVclPtr<MessageDialog> aBox(new MessageDialog(pParent, ResId(SV_EDIT_WARNING_STR, *pResMgr), VCL_MESSAGE_WARNING)); aBox->Execute(); } } @@ -2784,9 +2784,8 @@ Size Edit::CalcMinimumSize() const Size Edit::GetMinimumEditSize() { vcl::Window* pDefWin = ImplGetDefaultWindow(); - VclPtr<Edit> aEdit(new Edit( pDefWin, WB_BORDER ) ); + ScopedVclPtr<Edit> aEdit(new Edit( pDefWin, WB_BORDER ) ); Size aSize( aEdit->CalcMinimumSize() ); - aEdit.disposeAndClear(); return aSize; } diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index c6d33e0c931f..8216e6e1e7d4 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -304,7 +304,7 @@ void Printer::PreparePrintJob(std::shared_ptr<PrinterController> xController, { if (xController->isShowDialogs()) { - VclPtr<MessageDialog> aBox(new MessageDialog(NULL, "ErrorNoPrinterDialog", + ScopedVclPtr<MessageDialog> aBox(new MessageDialog(NULL, "ErrorNoPrinterDialog", "vcl/ui/errornoprinterdialog.ui")); aBox->Execute(); } @@ -453,7 +453,7 @@ void Printer::PreparePrintJob(std::shared_ptr<PrinterController> xController, { if( xController->getFilteredPageCount() == 0 ) { - VclPtr<MessageDialog> aBox(new MessageDialog(NULL, "ErrorNoContentDialog", + ScopedVclPtr<MessageDialog> aBox(new MessageDialog(NULL, "ErrorNoContentDialog", "vcl/ui/errornocontentdialog.ui")); aBox->Execute(); return; @@ -469,7 +469,7 @@ void Printer::PreparePrintJob(std::shared_ptr<PrinterController> xController, { try { - VclPtr<PrintDialog> aDlg(new PrintDialog( NULL, xController )); + ScopedVclPtrInstance<PrintDialog> aDlg( nullptr, xController ); if( ! aDlg->Execute() ) { xController->abortJob(); diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index 1ade01e83e01..9ca9c30a1b40 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 { - VclPtr<ImplBorderWindow> aImplWin( new ImplBorderWindow( (vcl::Window*)this, WB_BORDER|WB_STDWORK, BORDERWINDOW_STYLE_OVERLAP ) ); + ScopedVclPtr<ImplBorderWindow> aImplWin( new ImplBorderWindow( (vcl::Window*)this, WB_BORDER|WB_STDWORK, BORDERWINDOW_STYLE_OVERLAP ) ); aImplWin->GetBorder( rLeftBorder, rTopBorder, rRightBorder, rBottomBorder ); } @@ -1092,7 +1092,7 @@ void Dialog::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal if (!( GetStyle() & WB_NOBORDER )) { - VclPtr<ImplBorderWindow> aImplWin( new ImplBorderWindow(this, WB_BORDER|WB_STDWORK, BORDERWINDOW_STYLE_OVERLAP) ); + ScopedVclPtr<ImplBorderWindow> aImplWin( new ImplBorderWindow(this, WB_BORDER|WB_STDWORK, BORDERWINDOW_STYLE_OVERLAP) ); aImplWin->SetText( GetText() ); aImplWin->setPosSizePixel( aPos.X(), aPos.Y(), aSize.Width(), aSize.Height() ); aImplWin->SetDisplayActive( true ); diff --git a/vcl/source/window/menubarwindow.cxx b/vcl/source/window/menubarwindow.cxx index 7d92186488ab..0f49c51e78b0 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() { - VclPtr<ToolBox> aTbx( new ToolBox(GetParent()) ); + ScopedVclPtr<ToolBox> aTbx( new ToolBox(GetParent()) ); if( GetItemCount() == 0 ) { ResMgr* pResMgr = ImplGetResMgr(); diff --git a/vcl/unx/generic/printer/cupsmgr.cxx b/vcl/unx/generic/printer/cupsmgr.cxx index 533b07665b16..daddd1ac286f 100644 --- a/vcl/unx/generic/printer/cupsmgr.cxx +++ b/vcl/unx/generic/printer/cupsmgr.cxx @@ -966,7 +966,7 @@ namespace { bool bRet = false; - VclPtr<RTSPWDialog> aDialog(new RTSPWDialog(rServer, rUserName, NULL)); + ScopedVclPtr<RTSPWDialog> aDialog(new RTSPWDialog(rServer, rUserName, NULL)); if (aDialog->Execute()) { rUserName = aDialog->getUserName(); diff --git a/vcl/unx/x11/x11sys.cxx b/vcl/unx/x11/x11sys.cxx index 1e6ebe55bd76..8cad695b5265 100644 --- a/vcl/unx/x11/x11sys.cxx +++ b/vcl/unx/x11/x11sys.cxx @@ -134,7 +134,7 @@ int X11SalSystem::ShowNativeDialog( const OUString& rTitle, const OUString& rMes if( pSVData->mpIntroWindow ) pSVData->mpIntroWindow->Hide(); - VclPtr<WarningBox> aWarn(new WarningBox(NULL, WB_STDWORK, rMessage) ); + ScopedVclPtr<WarningBox> aWarn(new WarningBox(NULL, WB_STDWORK, rMessage) ); aWarn->SetText( rTitle ); aWarn->Clear(); diff --git a/vcl/workben/outdevgrind.cxx b/vcl/workben/outdevgrind.cxx index cf7a0d0ea8a2..d53074847f90 100644 --- a/vcl/workben/outdevgrind.cxx +++ b/vcl/workben/outdevgrind.cxx @@ -898,7 +898,7 @@ sal_uInt16 GrindApp::Exception( sal_uInt16 nError ) int GrindApp::Main() { - VclPtr<TestWindow> aWindow(new TestWindow); + ScopedVclPtr<TestWindow> aWindow(new TestWindow); aWindow->Execute(); return 0; } diff --git a/vcl/workben/svdem.cxx b/vcl/workben/svdem.cxx index 6b2e233f9c78..f2cdb6eaebac 100644 --- a/vcl/workben/svdem.cxx +++ b/vcl/workben/svdem.cxx @@ -81,7 +81,7 @@ public: void Main() { - VclPtr<MyWin> aMainWin(new MyWin(NULL, WB_APP | WB_STDWORK) ); + ScopedVclPtr<MyWin> aMainWin(new MyWin(NULL, WB_APP | WB_STDWORK) ); aMainWin->SetText(OUString("VCL - Workbench")); aMainWin->Show(); diff --git a/vcl/workben/svpclient.cxx b/vcl/workben/svpclient.cxx index ee218bb80687..cda0b34bf521 100644 --- a/vcl/workben/svpclient.cxx +++ b/vcl/workben/svpclient.cxx @@ -121,7 +121,7 @@ public: void Main() { - VclPtr<MyWin> aMainWin(new MyWin(NULL, WB_STDWORK) ); + ScopedVclPtr<MyWin> aMainWin(new MyWin(NULL, WB_STDWORK) ); aMainWin->SetText( OUString( "SvpClient" ) ); aMainWin->Show(); diff --git a/vcl/workben/svptest.cxx b/vcl/workben/svptest.cxx index ea6988633d94..70c769b71719 100644 --- a/vcl/workben/svptest.cxx +++ b/vcl/workben/svptest.cxx @@ -91,7 +91,7 @@ public: void Main() { - VclPtr<MyWin> aMainWin(new MyWin(NULL, WB_APP | WB_STDWORK) ); + ScopedVclPtr<MyWin> aMainWin(new MyWin(NULL, WB_APP | WB_STDWORK) ); aMainWin->SetText( OUString( "VCL - Workbench" ) ); aMainWin->Show(); diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index 4c4358ae4cbe..a7c0cfa503ff 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -1617,7 +1617,7 @@ public: } } - VclPtr<DemoWin> aMainWin(new DemoWin(aRenderer, bThreads)); + ScopedVclPtrInstance<DemoWin> aMainWin(aRenderer, bThreads); VclPtr<DemoWidgets> aWidgets; VclPtr<DemoPopup> xPopup; |