diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-09-15 09:17:14 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-09-15 09:30:05 +0200 |
commit | 538635e089cac31ddf433f650e86de5e2b7f03cc (patch) | |
tree | 1f0e246954203f0d480e5ec61c049feec0ec76f1 | |
parent | c3c4ae5fdac0341f01eeed8d5c633d203eed8b2a (diff) |
Make OGenericUnoDialog::destoryDialog non-virtual
...it is only ever called:
* either from dtors, where the virtual-ness doesn't acutally help (and would
trigger loplugin:fragiledestructor if that were enabled)
* or, in module filter, from executeDialog members of (final) classes directly
derived from OGenericUnODialog without overriding destroyDialog
Change-Id: If9a7370385a27952189423e5632b3f01e18ddbb5
-rw-r--r-- | dbaccess/source/ui/inc/unoadmin.hxx | 1 | ||||
-rw-r--r-- | dbaccess/source/ui/uno/unoadmin.cxx | 11 | ||||
-rw-r--r-- | extensions/source/propctrlr/controlfontdialog.cxx | 11 | ||||
-rw-r--r-- | extensions/source/propctrlr/controlfontdialog.hxx | 1 | ||||
-rw-r--r-- | filter/source/flash/swfdialog.hxx | 9 | ||||
-rw-r--r-- | filter/source/pdf/pdfdialog.hxx | 5 | ||||
-rw-r--r-- | filter/source/svg/svgdialog.hxx | 9 | ||||
-rw-r--r-- | include/svtools/genericunodialog.hxx | 4 | ||||
-rw-r--r-- | svtools/source/uno/wizard/unowizard.cxx | 45 |
9 files changed, 39 insertions, 57 deletions
diff --git a/dbaccess/source/ui/inc/unoadmin.hxx b/dbaccess/source/ui/inc/unoadmin.hxx index ba952dbd8ddd..49271328e413 100644 --- a/dbaccess/source/ui/inc/unoadmin.hxx +++ b/dbaccess/source/ui/inc/unoadmin.hxx @@ -53,7 +53,6 @@ protected: virtual ~ODatabaseAdministrationDialog() override; protected: // OGenericUnoDialog overridables - virtual void destroyDialog() override; virtual void implInitialize(const css::uno::Any& _rValue) override; }; diff --git a/dbaccess/source/ui/uno/unoadmin.cxx b/dbaccess/source/ui/uno/unoadmin.cxx index f866b6080d37..a7cf4676a0aa 100644 --- a/dbaccess/source/ui/uno/unoadmin.cxx +++ b/dbaccess/source/ui/uno/unoadmin.cxx @@ -55,13 +55,14 @@ ODatabaseAdministrationDialog::ODatabaseAdministrationDialog(const Reference< XC ODatabaseAdministrationDialog::~ODatabaseAdministrationDialog() { - // we do this here cause the base class' call to destroyDialog won't reach us anymore: we're within an dtor, - // so this virtual-method-call the base class does not work, we're already dead then... if (m_pDialog) { ::osl::MutexGuard aGuard(m_aMutex); if (m_pDialog) + { destroyDialog(); + ODbAdminDialog::destroyItemSet(m_pDatasourceItems, m_pItemPool, m_pItemPoolDefaults); + } } delete m_pCollection; @@ -69,12 +70,6 @@ ODatabaseAdministrationDialog::~ODatabaseAdministrationDialog() } -void ODatabaseAdministrationDialog::destroyDialog() -{ - ODatabaseAdministrationDialogBase::destroyDialog(); - ODbAdminDialog::destroyItemSet(m_pDatasourceItems, m_pItemPool, m_pItemPoolDefaults); -} - void ODatabaseAdministrationDialog::implInitialize(const Any& _rValue) { PropertyValue aProperty; diff --git a/extensions/source/propctrlr/controlfontdialog.cxx b/extensions/source/propctrlr/controlfontdialog.cxx index 13053015af9d..4ba8b5feaf25 100644 --- a/extensions/source/propctrlr/controlfontdialog.cxx +++ b/extensions/source/propctrlr/controlfontdialog.cxx @@ -57,7 +57,10 @@ namespace pcr { ::osl::MutexGuard aGuard(m_aMutex); if (m_pDialog) + { destroyDialog(); + ControlCharacterDialog::destroyItemSet(m_pFontItems, m_pItemPool, m_pItemPoolDefaults); + } } } @@ -150,14 +153,6 @@ namespace pcr return VclPtr<ControlCharacterDialog>::Create(_pParent, *m_pFontItems); } - - void OControlFontDialog::destroyDialog() - { - OGenericUnoDialog::destroyDialog(); - ControlCharacterDialog::destroyItemSet(m_pFontItems, m_pItemPool, m_pItemPoolDefaults); - } - - void OControlFontDialog::executedDialog(sal_Int16 _nExecutionResult) { OSL_ENSURE(m_pDialog, "OControlFontDialog::executedDialog: no dialog anymore?!!"); diff --git a/extensions/source/propctrlr/controlfontdialog.hxx b/extensions/source/propctrlr/controlfontdialog.hxx index de7917327aab..a7727a776d13 100644 --- a/extensions/source/propctrlr/controlfontdialog.hxx +++ b/extensions/source/propctrlr/controlfontdialog.hxx @@ -79,7 +79,6 @@ namespace pcr protected: // OGenericUnoDialog overridables virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) override; - virtual void destroyDialog() override; virtual void executedDialog(sal_Int16 _nExecutionResult) override; }; diff --git a/filter/source/flash/swfdialog.hxx b/filter/source/flash/swfdialog.hxx index f8a403d4ac92..8875a7e07b61 100644 --- a/filter/source/flash/swfdialog.hxx +++ b/filter/source/flash/swfdialog.hxx @@ -30,10 +30,11 @@ namespace vcl { class Window; } class ResMgr; -class SWFDialog : public ::svt::OGenericUnoDialog, - public ::comphelper::OPropertyArrayUsageHelper< SWFDialog >, - public css::beans::XPropertyAccess, - public css::document::XExporter +class SWFDialog final: + public ::svt::OGenericUnoDialog, + public ::comphelper::OPropertyArrayUsageHelper< SWFDialog >, + public css::beans::XPropertyAccess, + public css::document::XExporter { private: diff --git a/filter/source/pdf/pdfdialog.hxx b/filter/source/pdf/pdfdialog.hxx index b20cd4cd65a7..c40adedd9c13 100644 --- a/filter/source/pdf/pdfdialog.hxx +++ b/filter/source/pdf/pdfdialog.hxx @@ -30,8 +30,9 @@ namespace vcl { class Window; } typedef ::cppu::ImplInheritanceHelper < ::svt::OGenericUnoDialog, XPropertyAccess, XExporter > PDFDialog_Base; -class PDFDialog : public PDFDialog_Base, - public ::comphelper::OPropertyArrayUsageHelper< PDFDialog > +class PDFDialog final: + public PDFDialog_Base, + public ::comphelper::OPropertyArrayUsageHelper< PDFDialog > { private: Sequence< PropertyValue > maMediaDescriptor; diff --git a/filter/source/svg/svgdialog.hxx b/filter/source/svg/svgdialog.hxx index 24f80de25c69..80a4e283aa36 100644 --- a/filter/source/svg/svgdialog.hxx +++ b/filter/source/svg/svgdialog.hxx @@ -30,10 +30,11 @@ class ResMgr; -class SVGDialog : public ::svt::OGenericUnoDialog, - public ::comphelper::OPropertyArrayUsageHelper< SVGDialog >, - public css::beans::XPropertyAccess, - public css::document::XExporter +class SVGDialog final: + public ::svt::OGenericUnoDialog, + public ::comphelper::OPropertyArrayUsageHelper< SVGDialog >, + public css::beans::XPropertyAccess, + public css::document::XExporter { private: diff --git a/include/svtools/genericunodialog.hxx b/include/svtools/genericunodialog.hxx index 53885eddda96..025107bef43a 100644 --- a/include/svtools/genericunodialog.hxx +++ b/include/svtools/genericunodialog.hxx @@ -121,8 +121,8 @@ namespace svt */ virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) = 0; - /// called to destroy the dialog used. the default implementation just deletes m_pDialog and resets it to NULL - virtual void destroyDialog(); + /// called to destroy the dialog used. deletes m_pDialog and resets it to NULL + void destroyDialog(); /** called after the dialog has been executed @param _nExecutionResult the execution result as returned by Dialog::Execute diff --git a/svtools/source/uno/wizard/unowizard.cxx b/svtools/source/uno/wizard/unowizard.cxx index eaa4ad6faf51..492bbb9c0d27 100644 --- a/svtools/source/uno/wizard/unowizard.cxx +++ b/svtools/source/uno/wizard/unowizard.cxx @@ -133,7 +133,6 @@ namespace { protected: virtual VclPtr<Dialog> createDialog( vcl::Window* _pParent ) override; - virtual void destroyDialog() override; private: css::uno::Sequence< css::uno::Sequence< sal_Int16 > > m_aWizardSteps; @@ -146,16 +145,32 @@ namespace { { } + namespace { + + OUString lcl_getHelpURL( const OString& sHelpId ) + { + OUStringBuffer aBuffer; + OUString aTmp( + OStringToOUString( sHelpId, RTL_TEXTENCODING_UTF8 ) ); + INetURLObject aHID( aTmp ); + if ( aHID.GetProtocol() == INetProtocol::NotValid ) + aBuffer.append( INET_HID_SCHEME ); + aBuffer.append( aTmp.getStr() ); + return aBuffer.makeStringAndClear(); + } + + } Wizard::~Wizard() { - // we do this here cause the base class' call to destroyDialog won't reach us anymore: we're within an dtor, - // so this virtual-method-call the base class does not work, we're already dead then... if ( m_pDialog ) { ::osl::MutexGuard aGuard( m_aMutex ); if ( m_pDialog ) + { + m_sHelpURL = lcl_getHelpURL( m_pDialog->GetHelpId() ); destroyDialog(); + } } } @@ -250,20 +265,6 @@ namespace { return OUStringToOString( _rHelpURL, RTL_TEXTENCODING_UTF8 ); } - - OUString lcl_getHelpURL( const OString& sHelpId ) - { - OUStringBuffer aBuffer; - OUString aTmp( - OStringToOUString( sHelpId, RTL_TEXTENCODING_UTF8 ) ); - INetURLObject aHID( aTmp ); - if ( aHID.GetProtocol() == INetProtocol::NotValid ) - aBuffer.append( INET_HID_SCHEME ); - aBuffer.append( aTmp.getStr() ); - return aBuffer.makeStringAndClear(); - } - - VclPtr<Dialog> Wizard::createDialog( vcl::Window* i_pParent ) { VclPtrInstance<WizardShell> pDialog( i_pParent, m_xController, m_aWizardSteps ); @@ -272,16 +273,6 @@ namespace { return pDialog.get(); } - - void Wizard::destroyDialog() - { - if ( m_pDialog ) - m_sHelpURL = lcl_getHelpURL( m_pDialog->GetHelpId() ); - - Wizard_Base::destroyDialog(); - } - - OUString SAL_CALL Wizard::getImplementationName() throw(RuntimeException, std::exception) { return OUString("com.sun.star.comp.svtools.uno.Wizard"); |