Bug 133497 - OApplicationController::elementReplaced effectively does nothing
Summary: OApplicationController::elementReplaced effectively does nothing
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: needsDevAdvice
Depends on:
Blocks:
 
Reported: 2020-05-29 12:00 UTC by Stephan Bergmann
Modified: 2023-10-05 09:24 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephan Bergmann 2020-05-29 12:00:29 UTC
<https://git.libreoffice.org/core/+/760c03c8ee16ecfa7620174c0eabc9812cba9a83%5E!/> "INTEGRATION: CWS insight01" had introduced OApplicationController::elementReplaced in dbaccess/source/ui/app/AppController.cxx as

> +void SAL_CALL OApplicationController::elementReplaced( const ContainerEvent& _rEvent ) throw(RuntimeException)
> +{
> +    ::vos::OGuard aSolarGuard(Application::GetSolarMutex());
> +    ::osl::MutexGuard aGuard(m_aMutex);
> +
> +    Reference< XNameAccess > xNames(_rEvent.Source, UNO_QUERY);
> +    if ( xNames == m_xCurrentContainer || ::std::find(m_aCurrentSubContainers.begin(),m_aCurrentSubContainers.end(),Reference< XContainer >(xNames,UNO_QUERY)) != m_aCurrentSubContainers.end() )
> +    {
> +        OSL_ENSURE(getContainer(),"View is NULL! -> GPF");
> +        ::rtl::OUString sName;
> +        try
> +        {
> +            _rEvent.Accessor >>= sName;
> +            Reference<XConnection> xConnection;
> +            Reference<XPropertySet> xProp(_rEvent.Element,UNO_QUERY);
> +            ::rtl::OUString sNewName;
> +
> +            ElementType eType = getContainer()->getElementType();
> +            switch( eType )
> +            {
> +                case E_TABLE:
> +                    ensureConnection(xConnection);
> +                    if ( xProp.is() && xConnection.is() )
> +                    {
> +                        sNewName = ::dbaui::composeTableName(xConnection->getMetaData(),xProp,sal_False,::dbtools::eInDataManipulation);
> +                    }
> +                    break;
> +                case E_FORM:
> +                case E_REPORT:
> +                    {
> +                        Reference<XContent> xContent(xNames,UNO_QUERY);
> +                        if ( xContent.is() )
> +                        {
> +                            sName = xContent->getIdentifier()->getContentIdentifier() + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")) + sName;
> +                        }
> +                    }
> +                    break;
> +            }
> +            //  getContainer()->elementReplaced(getContainer()->getElementType(),sName,sNewName,xConnection);
> +        }
> +        catch( Exception& )
> +        {
> +            OSL_ENSURE(0,"Exception catched");
> +        }
> +    }
> +}

with the call to getContainer()->elementReplaced(...) commented out right from the start (and the code is still effectively the same today at <https://git.libreoffice.org/core/+/6647a167400753df45dba788ed793d55ca0be9f8/dbaccess/source/ui/app/AppController.cxx#1537>).

That means that all the code in that function effectively does nothing, except for potentially relevant side effects hidden behind any of its function calls.

The question is whether the function should be removed, or the commented-out code be enabled.