diff options
20 files changed, 826 insertions, 820 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 888b6a139014..9bded29ddcc7 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -304,21 +304,22 @@ void SetRestartState() { } void DoRestartActionsIfNecessary(bool quickstart) { - if (quickstart) { - try { - if (officecfg::Setup::Office::OfficeRestartInProgress::get()) { - std::shared_ptr< comphelper::ConfigurationChanges > batch( - comphelper::ConfigurationChanges::create()); - officecfg::Setup::Office::OfficeRestartInProgress::set( - false, batch); - batch->commit(); - css::office::Quickstart::createStart( - comphelper::getProcessComponentContext(), - shouldLaunchQuickstart()); - } - } catch (css::uno::Exception &) { - TOOLS_WARN_EXCEPTION("desktop.app", "ignoring"); - } + if (!quickstart) + return; + + try { + if (officecfg::Setup::Office::OfficeRestartInProgress::get()) { + std::shared_ptr< comphelper::ConfigurationChanges > batch( + comphelper::ConfigurationChanges::create()); + officecfg::Setup::Office::OfficeRestartInProgress::set( + false, batch); + batch->commit(); + css::office::Quickstart::createStart( + comphelper::getProcessComponentContext(), + shouldLaunchQuickstart()); + } + } catch (css::uno::Exception &) { + TOOLS_WARN_EXCEPTION("desktop.app", "ignoring"); } } @@ -496,41 +497,41 @@ void Desktop::Init() } } - if ( true ) + if ( !(true) ) + return; + + // start ipc thread only for non-remote offices + RequestHandler::Status aStatus = RequestHandler::Enable(true); + if ( aStatus == RequestHandler::IPC_STATUS_PIPE_ERROR ) { - // start ipc thread only for non-remote offices - RequestHandler::Status aStatus = RequestHandler::Enable(true); - if ( aStatus == RequestHandler::IPC_STATUS_PIPE_ERROR ) - { #if defined ANDROID - // Ignore crack pipe errors on Android + // Ignore crack pipe errors on Android #else - // Keep using this oddly named BE_PATHINFO_MISSING value - // for pipe-related errors on other platforms. Of course - // this crack with two (if not more) levels of our own - // error codes hiding the actual system error code is - // broken, but that is done all over the code, let's leave - // reengineering that to another year. - SetBootstrapError( BE_PATHINFO_MISSING, OUString() ); + // Keep using this oddly named BE_PATHINFO_MISSING value + // for pipe-related errors on other platforms. Of course + // this crack with two (if not more) levels of our own + // error codes hiding the actual system error code is + // broken, but that is done all over the code, let's leave + // reengineering that to another year. + SetBootstrapError( BE_PATHINFO_MISSING, OUString() ); #endif - } - else if ( aStatus == RequestHandler::IPC_STATUS_BOOTSTRAP_ERROR ) - { - SetBootstrapError( BE_PATHINFO_MISSING, OUString() ); - } - else if ( aStatus == RequestHandler::IPC_STATUS_2ND_OFFICE ) - { - // 2nd office startup should terminate after sending cmdlineargs through pipe - SetBootstrapStatus(BS_TERMINATE); - } - else if ( !rCmdLineArgs.GetUnknown().isEmpty() - || rCmdLineArgs.IsHelp() || rCmdLineArgs.IsVersion() ) - { - // disable IPC thread in an instance that is just showing a help message - RequestHandler::Disable(); - } - pSignalHandler = osl_addSignalHandler(SalMainPipeExchangeSignal_impl, nullptr); } + else if ( aStatus == RequestHandler::IPC_STATUS_BOOTSTRAP_ERROR ) + { + SetBootstrapError( BE_PATHINFO_MISSING, OUString() ); + } + else if ( aStatus == RequestHandler::IPC_STATUS_2ND_OFFICE ) + { + // 2nd office startup should terminate after sending cmdlineargs through pipe + SetBootstrapStatus(BS_TERMINATE); + } + else if ( !rCmdLineArgs.GetUnknown().isEmpty() + || rCmdLineArgs.IsHelp() || rCmdLineArgs.IsVersion() ) + { + // disable IPC thread in an instance that is just showing a help message + RequestHandler::Disable(); + } + pSignalHandler = osl_addSignalHandler(SalMainPipeExchangeSignal_impl, nullptr); } void Desktop::InitFinished() @@ -616,27 +617,27 @@ void Desktop::Shutdown() void Desktop::HandleBootstrapPathErrors( ::utl::Bootstrap::Status aBootstrapStatus, const OUString& aDiagnosticMessage ) { - if ( aBootstrapStatus != ::utl::Bootstrap::DATA_OK ) - { - OUString aProductKey; - OUString aTemp; + if ( aBootstrapStatus == ::utl::Bootstrap::DATA_OK ) + return; - osl_getExecutableFile( &aProductKey.pData ); - sal_uInt32 lastIndex = aProductKey.lastIndexOf('/'); - if ( lastIndex > 0 ) - aProductKey = aProductKey.copy( lastIndex+1 ); + OUString aProductKey; + OUString aTemp; - aTemp = ::utl::Bootstrap::getProductKey( aProductKey ); - if ( !aTemp.isEmpty() ) - aProductKey = aTemp; + osl_getExecutableFile( &aProductKey.pData ); + sal_uInt32 lastIndex = aProductKey.lastIndexOf('/'); + if ( lastIndex > 0 ) + aProductKey = aProductKey.copy( lastIndex+1 ); - OUString const aMessage(aDiagnosticMessage + "\n"); + aTemp = ::utl::Bootstrap::getProductKey( aProductKey ); + if ( !aTemp.isEmpty() ) + aProductKey = aTemp; - std::unique_ptr<weld::MessageDialog> xBootstrapFailedBox(Application::CreateMessageDialog(nullptr, - VclMessageType::Warning, VclButtonsType::Ok, aMessage)); - xBootstrapFailedBox->set_title(aProductKey); - xBootstrapFailedBox->run(); - } + OUString const aMessage(aDiagnosticMessage + "\n"); + + std::unique_ptr<weld::MessageDialog> xBootstrapFailedBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Warning, VclButtonsType::Ok, aMessage)); + xBootstrapFailedBox->set_title(aProductKey); + xBootstrapFailedBox->run(); } // Create an error message depending on bootstrap failure code and an optional file url @@ -2400,7 +2401,7 @@ void Desktop::OpenSplashScreen() { const CommandLineArgs &rCmdLine = GetCommandLineArgs(); // Show intro only if this is normal start (e.g. no server, no quickstart, no printing ) - if ( !rCmdLine.IsInvisible() && + if ( !(!rCmdLine.IsInvisible() && !rCmdLine.IsHeadless() && !rCmdLine.IsQuickstart() && !rCmdLine.IsMinimized() && @@ -2408,43 +2409,43 @@ void Desktop::OpenSplashScreen() !rCmdLine.IsTerminateAfterInit() && rCmdLine.GetPrintList().empty() && rCmdLine.GetPrintToList().empty() && - rCmdLine.GetConversionList().empty() ) - { - // Determine application name from command line parameters - OUString aAppName; - if ( rCmdLine.IsWriter() ) - aAppName = "writer"; - else if ( rCmdLine.IsCalc() ) - aAppName = "calc"; - else if ( rCmdLine.IsDraw() ) - aAppName = "draw"; - else if ( rCmdLine.IsImpress() ) - aAppName = "impress"; - else if ( rCmdLine.IsBase() ) - aAppName = "base"; - else if ( rCmdLine.IsGlobal() ) - aAppName = "global"; - else if ( rCmdLine.IsMath() ) - aAppName = "math"; - else if ( rCmdLine.IsWeb() ) - aAppName = "web"; - - // Which splash to use - OUString aSplashService( "com.sun.star.office.SplashScreen" ); - if ( rCmdLine.HasSplashPipe() ) - aSplashService = "com.sun.star.office.PipeSplashScreen"; - - Sequence< Any > aSeq( 2 ); - aSeq[0] <<= true; // bVisible - aSeq[1] <<= aAppName; - css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); - m_rSplashScreen.set( - xContext->getServiceManager()->createInstanceWithArgumentsAndContext(aSplashService, aSeq, xContext), - UNO_QUERY); - - if(m_rSplashScreen.is()) - m_rSplashScreen->start("SplashScreen", 100); - } + rCmdLine.GetConversionList().empty()) ) + return; + + // Determine application name from command line parameters + OUString aAppName; + if ( rCmdLine.IsWriter() ) + aAppName = "writer"; + else if ( rCmdLine.IsCalc() ) + aAppName = "calc"; + else if ( rCmdLine.IsDraw() ) + aAppName = "draw"; + else if ( rCmdLine.IsImpress() ) + aAppName = "impress"; + else if ( rCmdLine.IsBase() ) + aAppName = "base"; + else if ( rCmdLine.IsGlobal() ) + aAppName = "global"; + else if ( rCmdLine.IsMath() ) + aAppName = "math"; + else if ( rCmdLine.IsWeb() ) + aAppName = "web"; + + // Which splash to use + OUString aSplashService( "com.sun.star.office.SplashScreen" ); + if ( rCmdLine.HasSplashPipe() ) + aSplashService = "com.sun.star.office.PipeSplashScreen"; + + Sequence< Any > aSeq( 2 ); + aSeq[0] <<= true; // bVisible + aSeq[1] <<= aAppName; + css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + m_rSplashScreen.set( + xContext->getServiceManager()->createInstanceWithArgumentsAndContext(aSplashService, aSeq, xContext), + UNO_QUERY); + + if(m_rSplashScreen.is()) + m_rSplashScreen->start("SplashScreen", 100); } @@ -2505,68 +2506,68 @@ void Desktop::ShowBackingComponent(Desktop * progress) if (xBackingFrame.is()) xContainerWindow = xBackingFrame->getContainerWindow(); - if (xContainerWindow.is()) - { - // set the WindowExtendedStyle::Document style. Normally, this is done by the TaskCreator service when a "_blank" - // frame/window is created. Since we do not use the TaskCreator here, we need to mimic its behavior, - // otherwise documents loaded into this frame will later on miss functionality depending on the style. - VclPtr<vcl::Window> pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ); - SAL_WARN_IF( !pContainerWindow, "desktop.app", "Desktop::Main: no implementation access to the frame's container window!" ); - pContainerWindow->SetExtendedStyle( pContainerWindow->GetExtendedStyle() | WindowExtendedStyle::Document ); - if (progress != nullptr) - { - progress->SetSplashScreenProgress(75); - } + if (!xContainerWindow.is()) + return; - Reference< XController > xStartModule = StartModule::createWithParentWindow( xContext, xContainerWindow); - // Attention: You MUST(!) call setComponent() before you call attachFrame(). - // Because the backing component set the property "IsBackingMode" of the frame - // to true inside attachFrame(). But setComponent() reset this state everytimes ... - xBackingFrame->setComponent(Reference< XWindow >(xStartModule, UNO_QUERY), xStartModule); - if (progress != nullptr) - { - progress->SetSplashScreenProgress(100); - } - xStartModule->attachFrame(xBackingFrame); - if (progress != nullptr) - { - progress->CloseSplashScreen(); - } - xContainerWindow->setVisible(true); + // set the WindowExtendedStyle::Document style. Normally, this is done by the TaskCreator service when a "_blank" + // frame/window is created. Since we do not use the TaskCreator here, we need to mimic its behavior, + // otherwise documents loaded into this frame will later on miss functionality depending on the style. + VclPtr<vcl::Window> pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ); + SAL_WARN_IF( !pContainerWindow, "desktop.app", "Desktop::Main: no implementation access to the frame's container window!" ); + pContainerWindow->SetExtendedStyle( pContainerWindow->GetExtendedStyle() | WindowExtendedStyle::Document ); + if (progress != nullptr) + { + progress->SetSplashScreenProgress(75); } + + Reference< XController > xStartModule = StartModule::createWithParentWindow( xContext, xContainerWindow); + // Attention: You MUST(!) call setComponent() before you call attachFrame(). + // Because the backing component set the property "IsBackingMode" of the frame + // to true inside attachFrame(). But setComponent() reset this state everytimes ... + xBackingFrame->setComponent(Reference< XWindow >(xStartModule, UNO_QUERY), xStartModule); + if (progress != nullptr) + { + progress->SetSplashScreenProgress(100); + } + xStartModule->attachFrame(xBackingFrame); + if (progress != nullptr) + { + progress->CloseSplashScreen(); + } + xContainerWindow->setVisible(true); } void Desktop::CheckFirstRun( ) { - if (officecfg::Office::Common::Misc::FirstRun::get()) - { - // use VCL timer, which won't trigger during shutdown if the - // application exits before timeout - m_firstRunTimer.Start(); + if (!officecfg::Office::Common::Misc::FirstRun::get()) + return; + + // use VCL timer, which won't trigger during shutdown if the + // application exits before timeout + m_firstRunTimer.Start(); #ifdef _WIN32 - // Check if Quickstarter should be started (on Windows only) - OUString sRootKey = ReplaceStringHookProc("Software\\%OOOVENDOR\\%PRODUCTNAME\\%PRODUCTVERSION"); - WCHAR szValue[8192]; - DWORD nValueSize = sizeof(szValue); - HKEY hKey; - if (ERROR_SUCCESS == RegOpenKeyW(HKEY_LOCAL_MACHINE, o3tl::toW(sRootKey.getStr()), &hKey)) + // Check if Quickstarter should be started (on Windows only) + OUString sRootKey = ReplaceStringHookProc("Software\\%OOOVENDOR\\%PRODUCTNAME\\%PRODUCTVERSION"); + WCHAR szValue[8192]; + DWORD nValueSize = sizeof(szValue); + HKEY hKey; + if (ERROR_SUCCESS == RegOpenKeyW(HKEY_LOCAL_MACHINE, o3tl::toW(sRootKey.getStr()), &hKey)) + { + if ( ERROR_SUCCESS == RegQueryValueExW( hKey, L"RunQuickstartAtFirstStart", nullptr, nullptr, reinterpret_cast<LPBYTE>(szValue), &nValueSize ) ) { - if ( ERROR_SUCCESS == RegQueryValueExW( hKey, L"RunQuickstartAtFirstStart", nullptr, nullptr, reinterpret_cast<LPBYTE>(szValue), &nValueSize ) ) - { - css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); - css::office::Quickstart::createAutoStart(xContext, true/*Quickstart*/, true/*bAutostart*/); - RegCloseKey( hKey ); - } + css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + css::office::Quickstart::createAutoStart(xContext, true/*Quickstart*/, true/*bAutostart*/); + RegCloseKey( hKey ); } + } #endif - std::shared_ptr< comphelper::ConfigurationChanges > batch( - comphelper::ConfigurationChanges::create()); - officecfg::Office::Common::Misc::FirstRun::set(false, batch); - batch->commit(); - } + std::shared_ptr< comphelper::ConfigurationChanges > batch( + comphelper::ConfigurationChanges::create()); + officecfg::Office::Common::Misc::FirstRun::set(false, batch); + batch->commit(); } } diff --git a/desktop/source/app/appinit.cxx b/desktop/source/app/appinit.cxx index b3d0c98cea27..cff0a684cfcf 100644 --- a/desktop/source/app/appinit.cxx +++ b/desktop/source/app/appinit.cxx @@ -87,35 +87,35 @@ void Desktop::InitApplicationServiceManager() void Desktop::RegisterServices(Reference< XComponentContext > const & context) { - if( !m_bServicesRegistered ) - { - // interpret command line arguments - CommandLineArgs& rCmdLine = GetCommandLineArgs(); - - // Headless mode for FAT Office, auto cancels any dialogs that popup - if (rCmdLine.IsEventTesting()) - Application::EnableEventTestingMode(); - else if (rCmdLine.IsHeadless()) - Application::EnableHeadlessMode(false); - - // read accept string from configuration - OUString conDcpCfg( - officecfg::Setup::Office::ooSetupConnectionURL::get(context)); - if (!conDcpCfg.isEmpty()) { - createAcceptor(conDcpCfg); - } + if( m_bServicesRegistered ) + return; + + // interpret command line arguments + CommandLineArgs& rCmdLine = GetCommandLineArgs(); + + // Headless mode for FAT Office, auto cancels any dialogs that popup + if (rCmdLine.IsEventTesting()) + Application::EnableEventTestingMode(); + else if (rCmdLine.IsHeadless()) + Application::EnableHeadlessMode(false); + + // read accept string from configuration + OUString conDcpCfg( + officecfg::Setup::Office::ooSetupConnectionURL::get(context)); + if (!conDcpCfg.isEmpty()) { + createAcceptor(conDcpCfg); + } - std::vector< OUString > const & conDcp = rCmdLine.GetAccept(); - for (auto const& elem : conDcp) - { - createAcceptor(elem); - } + std::vector< OUString > const & conDcp = rCmdLine.GetAccept(); + for (auto const& elem : conDcp) + { + createAcceptor(elem); + } - configureUcb(); + configureUcb(); - CreateTemporaryDirectory(); - m_bServicesRegistered = true; - } + CreateTemporaryDirectory(); + m_bServicesRegistered = true; } typedef std::map< OUString, css::uno::Reference<css::lang::XInitialization> > AcceptorMap; @@ -133,35 +133,35 @@ void Desktop::createAcceptor(const OUString& aAcceptString) // check whether the requested acceptor already exists AcceptorMap &rMap = acceptorMap::get(); AcceptorMap::const_iterator pIter = rMap.find(aAcceptString); - if (pIter == rMap.end() ) + if (pIter != rMap.end() ) + return; + + Sequence< Any > aSeq( 2 ); + aSeq[0] <<= aAcceptString; + aSeq[1] <<= bAccept; + Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + Reference<XInitialization> rAcceptor( + xContext->getServiceManager()->createInstanceWithContext("com.sun.star.office.Acceptor", xContext), + UNO_QUERY ); + if ( rAcceptor.is() ) { - Sequence< Any > aSeq( 2 ); - aSeq[0] <<= aAcceptString; - aSeq[1] <<= bAccept; - Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); - Reference<XInitialization> rAcceptor( - xContext->getServiceManager()->createInstanceWithContext("com.sun.star.office.Acceptor", xContext), - UNO_QUERY ); - if ( rAcceptor.is() ) + try { - try - { - rAcceptor->initialize( aSeq ); - rMap.emplace(aAcceptString, rAcceptor); - } - catch (const css::uno::Exception&) - { - // no error handling needed... - // acceptor just won't come up - TOOLS_WARN_EXCEPTION( "desktop.app", "Acceptor could not be created"); - } + rAcceptor->initialize( aSeq ); + rMap.emplace(aAcceptString, rAcceptor); } - else + catch (const css::uno::Exception&) { - // there is already an acceptor with this description - SAL_WARN( "desktop.app", "Acceptor already exists."); + // no error handling needed... + // acceptor just won't come up + TOOLS_WARN_EXCEPTION( "desktop.app", "Acceptor could not be created"); } } + else + { + // there is already an acceptor with this description + SAL_WARN( "desktop.app", "Acceptor already exists."); + } } namespace { diff --git a/desktop/source/app/langselect.cxx b/desktop/source/app/langselect.cxx index 17b7913c09e3..468ba9368ee5 100644 --- a/desktop/source/app/langselect.cxx +++ b/desktop/source/app/langselect.cxx @@ -52,19 +52,20 @@ OUString foundLocale; void setMsLangIdFallback(OUString const & locale) { // #i32939# setting of default document language // See #i42730# for rules for determining source of settings - if (!locale.isEmpty()) { - LanguageType type = LanguageTag::convertToLanguageTypeWithFallback(locale); - switch (SvtLanguageOptions::GetScriptTypeOfLanguage(type)) { - case SvtScriptType::ASIAN: - MsLangId::setConfiguredAsianFallback(type); - break; - case SvtScriptType::COMPLEX: - MsLangId::setConfiguredComplexFallback(type); - break; - default: - MsLangId::setConfiguredWesternFallback(type); - break; - } + if (locale.isEmpty()) + return; + + LanguageType type = LanguageTag::convertToLanguageTypeWithFallback(locale); + switch (SvtLanguageOptions::GetScriptTypeOfLanguage(type)) { + case SvtScriptType::ASIAN: + MsLangId::setConfiguredAsianFallback(type); + break; + case SvtScriptType::COMPLEX: + MsLangId::setConfiguredComplexFallback(type); + break; + default: + MsLangId::setConfiguredWesternFallback(type); + break; } } diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx index 923aab00c702..18c9f4e40dc4 100644 --- a/desktop/source/app/officeipcthread.cxx +++ b/desktop/source/app/officeipcthread.cxx @@ -869,30 +869,30 @@ void RequestHandler::Disable() { osl::ClearableMutexGuard aMutex( GetMutex() ); - if( pGlobal.is() ) - { - rtl::Reference< RequestHandler > handler(pGlobal); - pGlobal.clear(); + if( !pGlobal.is() ) + return; - handler->mState = State::Downing; - if (handler->mIpcThread.is()) { - handler->mIpcThread->close(); - } + rtl::Reference< RequestHandler > handler(pGlobal); + pGlobal.clear(); - // release mutex to avoid deadlocks - aMutex.clear(); + handler->mState = State::Downing; + if (handler->mIpcThread.is()) { + handler->mIpcThread->close(); + } - handler->cReady.set(); + // release mutex to avoid deadlocks + aMutex.clear(); - // exit gracefully and join - if (handler->mIpcThread.is()) - { - handler->mIpcThread->join(); - handler->mIpcThread.clear(); - } + handler->cReady.set(); - handler->cReady.reset(); + // exit gracefully and join + if (handler->mIpcThread.is()) + { + handler->mIpcThread->join(); + handler->mIpcThread.clear(); } + + handler->cReady.reset(); } RequestHandler::RequestHandler() : diff --git a/desktop/source/app/opencl.cxx b/desktop/source/app/opencl.cxx index a1fe3c0f6aea..0ea322e02565 100644 --- a/desktop/source/app/opencl.cxx +++ b/desktop/source/app/opencl.cxx @@ -223,32 +223,32 @@ void Desktop::CheckOpenCLCompute(const Reference< XDesktop2 > &xDesktop) aSelectedCLDeviceVersionID += "--" + OUString::number(aTimeVal.Seconds); - if (aSelectedCLDeviceVersionID != officecfg::Office::Common::Misc::SelectedOpenCLDeviceIdentifier::get()) - { - // OpenCL device changed - sanity check it and disable if bad. + if (aSelectedCLDeviceVersionID == officecfg::Office::Common::Misc::SelectedOpenCLDeviceIdentifier::get()) + return; - sal_Int32 nOrigMinimumSize = officecfg::Office::Calc::Formula::Calculation::OpenCLMinimumDataSize::get(); - { // set the minimum group size to something small for quick testing. - std::shared_ptr<comphelper::ConfigurationChanges> xBatch(comphelper::ConfigurationChanges::create()); - officecfg::Office::Calc::Formula::Calculation::OpenCLMinimumDataSize::set(3 /* small */, xBatch); - xBatch->commit(); - } + // OpenCL device changed - sanity check it and disable if bad. - // Hopefully at least basic functionality always works and broken OpenCL implementations break - // only when they are used to compute something. If this assumptions turns out to be not true, - // the driver check needs to be moved sooner. - bool bSucceeded = testOpenCLDriver() && testOpenCLCompute(xDesktop, aURL); + sal_Int32 nOrigMinimumSize = officecfg::Office::Calc::Formula::Calculation::OpenCLMinimumDataSize::get(); + { // set the minimum group size to something small for quick testing. + std::shared_ptr<comphelper::ConfigurationChanges> xBatch(comphelper::ConfigurationChanges::create()); + officecfg::Office::Calc::Formula::Calculation::OpenCLMinimumDataSize::set(3 /* small */, xBatch); + xBatch->commit(); + } - { // restore the minimum group size - std::shared_ptr<comphelper::ConfigurationChanges> xBatch(comphelper::ConfigurationChanges::create()); - officecfg::Office::Calc::Formula::Calculation::OpenCLMinimumDataSize::set(nOrigMinimumSize, xBatch); - officecfg::Office::Common::Misc::SelectedOpenCLDeviceIdentifier::set(aSelectedCLDeviceVersionID, xBatch); - xBatch->commit(); - } + // Hopefully at least basic functionality always works and broken OpenCL implementations break + // only when they are used to compute something. If this assumptions turns out to be not true, + // the driver check needs to be moved sooner. + bool bSucceeded = testOpenCLDriver() && testOpenCLCompute(xDesktop, aURL); - if (!bSucceeded) - OpenCLZone::hardDisable(); + { // restore the minimum group size + std::shared_ptr<comphelper::ConfigurationChanges> xBatch(comphelper::ConfigurationChanges::create()); + officecfg::Office::Calc::Formula::Calculation::OpenCLMinimumDataSize::set(nOrigMinimumSize, xBatch); + officecfg::Office::Common::Misc::SelectedOpenCLDeviceIdentifier::set(aSelectedCLDeviceVersionID, xBatch); + xBatch->commit(); } + + if (!bSucceeded) + OpenCLZone::hardDisable(); } #endif // HAVE_FEATURE_OPENCL diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx index 4ccac79a4f24..3e0ca1a7ab9c 100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx @@ -978,52 +978,52 @@ void ExtensionBox_Impl::updateEntry( const uno::Reference< deployment::XPackage //is in the disposing state and all calls on it may result in a DisposedException. void ExtensionBox_Impl::removeEntry( const uno::Reference< deployment::XPackage > &xPackage ) { - if ( ! m_bInDelete ) - { - bool invalidate = false; - { - ::osl::ClearableMutexGuard aGuard( m_entriesMutex ); + if ( m_bInDelete ) + return; - auto iIndex = std::find_if(m_vEntries.begin(), m_vEntries.end(), - [&xPackage](const TEntry_Impl& rxEntry) { return rxEntry->m_xPackage == xPackage; }); - if (iIndex != m_vEntries.end()) - { - long nPos = iIndex - m_vEntries.begin(); + bool invalidate = false; + { + ::osl::ClearableMutexGuard aGuard( m_entriesMutex ); - // Entries mustn't be removed here, because they contain a hyperlink control - // which can only be deleted when the thread has the solar mutex. Therefore - // the entry will be moved into the m_vRemovedEntries list which will be - // cleared on the next paint event - m_vRemovedEntries.push_back( *iIndex ); - (*iIndex)->m_xPackage->removeEventListener(m_xRemoveListener.get()); - m_vEntries.erase( iIndex ); + auto iIndex = std::find_if(m_vEntries.begin(), m_vEntries.end(), + [&xPackage](const TEntry_Impl& rxEntry) { return rxEntry->m_xPackage == xPackage; }); + if (iIndex != m_vEntries.end()) + { + long nPos = iIndex - m_vEntries.begin(); - m_bNeedsRecalc = true; + // Entries mustn't be removed here, because they contain a hyperlink control + // which can only be deleted when the thread has the solar mutex. Therefore + // the entry will be moved into the m_vRemovedEntries list which will be + // cleared on the next paint event + m_vRemovedEntries.push_back( *iIndex ); + (*iIndex)->m_xPackage->removeEventListener(m_xRemoveListener.get()); + m_vEntries.erase( iIndex ); - if ( IsReallyVisible() ) - invalidate = true; + m_bNeedsRecalc = true; - if ( m_bHasActive ) - { - if ( nPos < m_nActive ) - m_nActive -= 1; - else if ( ( nPos == m_nActive ) && - ( nPos == static_cast<long>(m_vEntries.size()) ) ) - m_nActive -= 1; + if ( IsReallyVisible() ) + invalidate = true; - m_bHasActive = false; - //clear before calling out of this method - aGuard.clear(); - selectEntry( m_nActive ); - } + if ( m_bHasActive ) + { + if ( nPos < m_nActive ) + m_nActive -= 1; + else if ( ( nPos == m_nActive ) && + ( nPos == static_cast<long>(m_vEntries.size()) ) ) + m_nActive -= 1; + + m_bHasActive = false; + //clear before calling out of this method + aGuard.clear(); + selectEntry( m_nActive ); } } + } - if (invalidate) - { - SolarMutexGuard g; - Invalidate(); - } + if (invalidate) + { + SolarMutexGuard g; + Invalidate(); } } diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx index 446c4ae06571..66600848abd2 100644 --- a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx +++ b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx @@ -262,25 +262,25 @@ bool TheExtensionManager::installPackage( const OUString &rPackageURL, bool bWar void TheExtensionManager::terminateDialog() { - if ( ! dp_misc::office_is_running() ) + if ( dp_misc::office_is_running() ) + return; + + const SolarMutexGuard guard; + if (m_xExtMgrDialog) { - const SolarMutexGuard guard; - if (m_xExtMgrDialog) + if (m_bExtMgrDialogExecuting) + m_xExtMgrDialog->response(RET_CANCEL); + else { - if (m_bExtMgrDialogExecuting) - m_xExtMgrDialog->response(RET_CANCEL); - else - { - m_xExtMgrDialog->Close(); - m_xExtMgrDialog.reset(); - } + m_xExtMgrDialog->Close(); + m_xExtMgrDialog.reset(); } - assert(!m_xExtMgrDialog); - if (m_xUpdReqDialog) - m_xUpdReqDialog->response(RET_CANCEL); - assert(!m_xUpdReqDialog); - Application::Quit(); } + assert(!m_xExtMgrDialog); + if (m_xUpdReqDialog) + m_xUpdReqDialog->response(RET_CANCEL); + assert(!m_xUpdReqDialog); + Application::Quit(); } @@ -436,28 +436,28 @@ void TheExtensionManager::disposing( lang::EventObject const & rEvt ) m_xDesktop.clear(); } - if ( shutDown ) + if ( !shutDown ) + return; + + if ( dp_misc::office_is_running() ) { - if ( dp_misc::office_is_running() ) + const SolarMutexGuard guard; + if (m_xExtMgrDialog) { - const SolarMutexGuard guard; - if (m_xExtMgrDialog) + if (m_bExtMgrDialogExecuting) + m_xExtMgrDialog->response(RET_CANCEL); + else { - if (m_bExtMgrDialogExecuting) - m_xExtMgrDialog->response(RET_CANCEL); - else - { - m_xExtMgrDialog->Close(); - m_xExtMgrDialog.reset(); - } + m_xExtMgrDialog->Close(); + m_xExtMgrDialog.reset(); } - assert(!m_xExtMgrDialog); - if (m_xUpdReqDialog) - m_xUpdReqDialog->response(RET_CANCEL); - assert(!m_xUpdReqDialog); } - s_ExtMgr.clear(); + assert(!m_xExtMgrDialog); + if (m_xUpdReqDialog) + m_xUpdReqDialog->response(RET_CANCEL); + assert(!m_xUpdReqDialog); } + s_ExtMgr.clear(); } // XTerminateListener diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx index 708c40215fa5..b8c23c60dfdb 100644 --- a/desktop/source/deployment/manager/dp_extensionmanager.cxx +++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx @@ -931,19 +931,19 @@ void ExtensionManager::enableExtension( excOccurred <<= exc; } - if (excOccurred.hasValue()) + if (!excOccurred.hasValue()) + return; + + try + { + activateExtension(dp_misc::getIdentifier(extension), + extension->getName(), bUserDisabled, false, + xAbortChannel, xCmdEnv); + } + catch (...) { - try - { - activateExtension(dp_misc::getIdentifier(extension), - extension->getName(), bUserDisabled, false, - xAbortChannel, xCmdEnv); - } - catch (...) - { - } - ::cppu::throwException(excOccurred); } + ::cppu::throwException(excOccurred); } sal_Int32 ExtensionManager::checkPrerequisitesAndEnable( @@ -1032,19 +1032,19 @@ void ExtensionManager::disableExtension( excOccurred <<= exc; } - if (excOccurred.hasValue()) + if (!excOccurred.hasValue()) + return; + + try + { + activateExtension(dp_misc::getIdentifier(extension), + extension->getName(), bUserDisabled, false, + xAbortChannel, xCmdEnv); + } + catch (...) { - try - { - activateExtension(dp_misc::getIdentifier(extension), - extension->getName(), bUserDisabled, false, - xAbortChannel, xCmdEnv); - } - catch (...) - { - } - ::cppu::throwException(excOccurred); } + ::cppu::throwException(excOccurred); } uno::Sequence< Reference<css::deployment::XPackage> > diff --git a/desktop/source/deployment/misc/dp_descriptioninfoset.cxx b/desktop/source/deployment/misc/dp_descriptioninfoset.cxx index 86e8c4508d9a..0caa69534820 100644 --- a/desktop/source/deployment/misc/dp_descriptioninfoset.cxx +++ b/desktop/source/deployment/misc/dp_descriptioninfoset.cxx @@ -344,86 +344,87 @@ OUString DescriptionInfoset::getNodeValueFromExpression(OUString const & express void DescriptionInfoset::checkBlacklist() const { - if (m_element.is()) { - std::optional< OUString > id(getIdentifier()); - if (!id) - return; // nothing to check - OUString currentversion(getVersion()); - if (currentversion.getLength() == 0) - return; // nothing to check - - css::uno::Sequence<css::uno::Any> args(comphelper::InitAnyPropertySequence( - { - {"nodepath", css::uno::Any(OUString("/org.openoffice.Office.ExtensionDependencies/Extensions"))} - })); - css::uno::Reference< css::container::XNameAccess > blacklist( - (css::configuration::theDefaultProvider::get(m_context) - ->createInstanceWithArguments( - "com.sun.star.configuration.ConfigurationAccess", args)), - css::uno::UNO_QUERY_THROW); - - // check first if a blacklist entry is available - if (blacklist.is() && blacklist->hasByName(*id)) { - css::uno::Reference< css::beans::XPropertySet > extProps( - blacklist->getByName(*id), css::uno::UNO_QUERY_THROW); - - css::uno::Any anyValue = extProps->getPropertyValue("Versions"); - - css::uno::Sequence< OUString > blversions; - anyValue >>= blversions; - - // check if the current version requires further dependency checks from the blacklist - if (checkBlacklistVersion(currentversion, blversions)) { - anyValue = extProps->getPropertyValue("Dependencies"); - OUString udeps; - anyValue >>= udeps; - - if (udeps.getLength() == 0) - return; // nothing todo - - OString xmlDependencies = OUStringToOString(udeps, RTL_TEXTENCODING_UNICODE); - - css::uno::Reference< css::xml::dom::XDocumentBuilder> docbuilder( - m_context->getServiceManager()->createInstanceWithContext("com.sun.star.xml.dom.DocumentBuilder", m_context), - css::uno::UNO_QUERY_THROW); - - css::uno::Sequence< sal_Int8 > byteSeq(reinterpret_cast<const sal_Int8*>(xmlDependencies.getStr()), xmlDependencies.getLength()); - - css::uno::Reference< css::io::XInputStream> inputstream( css::io::SequenceInputStream::createStreamFromSequence(m_context, byteSeq), - css::uno::UNO_QUERY_THROW); - - css::uno::Reference< css::xml::dom::XDocument > xDocument(docbuilder->parse(inputstream)); - css::uno::Reference< css::xml::dom::XElement > xElement(xDocument->getDocumentElement()); - css::uno::Reference< css::xml::dom::XNodeList > xDeps(xElement->getChildNodes()); - sal_Int32 nLen = xDeps->getLength(); - - // get the parent xml document of current description info for the import - css::uno::Reference< css::xml::dom::XDocument > xCurrentDescInfo(m_element->getOwnerDocument()); - - // get dependency node of current description info to merge the new dependencies from the blacklist - css::uno::Reference< css::xml::dom::XNode > xCurrentDeps( - m_xpath->selectSingleNode(m_element, "desc:dependencies")); - - // if no dependency node exists, create a new one in the current description info - if (!xCurrentDeps.is()) { - css::uno::Reference< css::xml::dom::XNode > xNewDepNode( - xCurrentDescInfo->createElementNS( - "http://openoffice.org/extensions/description/2006", - "dependencies"), css::uno::UNO_QUERY_THROW); - m_element->appendChild(xNewDepNode); - xCurrentDeps = m_xpath->selectSingleNode(m_element, "desc:dependencies"); - } - - for (sal_Int32 i=0; i<nLen; i++) { - css::uno::Reference< css::xml::dom::XNode > xNode(xDeps->item(i)); - css::uno::Reference< css::xml::dom::XElement > xDep(xNode, css::uno::UNO_QUERY); - if (xDep.is()) { - // found valid blacklist dependency, import the node first and append it to the existing dependency node - css::uno::Reference< css::xml::dom::XNode > importedNode = xCurrentDescInfo->importNode(xNode, true); - xCurrentDeps->appendChild(importedNode); - } - } - } + if (!m_element.is()) + return; + + std::optional< OUString > id(getIdentifier()); + if (!id) + return; // nothing to check + OUString currentversion(getVersion()); + if (currentversion.getLength() == 0) + return; // nothing to check + + css::uno::Sequence<css::uno::Any> args(comphelper::InitAnyPropertySequence( + { + {"nodepath", css::uno::Any(OUString("/org.openoffice.Office.ExtensionDependencies/Extensions"))} + })); + css::uno::Reference< css::container::XNameAccess > blacklist( + (css::configuration::theDefaultProvider::get(m_context) + ->createInstanceWithArguments( + "com.sun.star.configuration.ConfigurationAccess", args)), + css::uno::UNO_QUERY_THROW); + + // check first if a blacklist entry is available + if (!(blacklist.is() && blacklist->hasByName(*id))) return; + + css::uno::Reference< css::beans::XPropertySet > extProps( + blacklist->getByName(*id), css::uno::UNO_QUERY_THROW); + + css::uno::Any anyValue = extProps->getPropertyValue("Versions"); + + css::uno::Sequence< OUString > blversions; + anyValue >>= blversions; + + // check if the current version requires further dependency checks from the blacklist + if (!checkBlacklistVersion(currentversion, blversions)) return; + + anyValue = extProps->getPropertyValue("Dependencies"); + OUString udeps; + anyValue >>= udeps; + + if (udeps.getLength() == 0) + return; // nothing todo + + OString xmlDependencies = OUStringToOString(udeps, RTL_TEXTENCODING_UNICODE); + + css::uno::Reference< css::xml::dom::XDocumentBuilder> docbuilder( + m_context->getServiceManager()->createInstanceWithContext("com.sun.star.xml.dom.DocumentBuilder", m_context), + css::uno::UNO_QUERY_THROW); + + css::uno::Sequence< sal_Int8 > byteSeq(reinterpret_cast<const sal_Int8*>(xmlDependencies.getStr()), xmlDependencies.getLength()); + + css::uno::Reference< css::io::XInputStream> inputstream( css::io::SequenceInputStream::createStreamFromSequence(m_context, byteSeq), + css::uno::UNO_QUERY_THROW); + + css::uno::Reference< css::xml::dom::XDocument > xDocument(docbuilder->parse(inputstream)); + css::uno::Reference< css::xml::dom::XElement > xElement(xDocument->getDocumentElement()); + css::uno::Reference< css::xml::dom::XNodeList > xDeps(xElement->getChildNodes()); + sal_Int32 nLen = xDeps->getLength(); + + // get the parent xml document of current description info for the import + css::uno::Reference< css::xml::dom::XDocument > xCurrentDescInfo(m_element->getOwnerDocument()); + + // get dependency node of current description info to merge the new dependencies from the blacklist + css::uno::Reference< css::xml::dom::XNode > xCurrentDeps( + m_xpath->selectSingleNode(m_element, "desc:dependencies")); + + // if no dependency node exists, create a new one in the current description info + if (!xCurrentDeps.is()) { + css::uno::Reference< css::xml::dom::XNode > xNewDepNode( + xCurrentDescInfo->createElementNS( + "http://openoffice.org/extensions/description/2006", + "dependencies"), css::uno::UNO_QUERY_THROW); + m_element->appendChild(xNewDepNode); + xCurrentDeps = m_xpath->selectSingleNode(m_element, "desc:dependencies"); + } + + for (sal_Int32 i=0; i<nLen; i++) { + css::uno::Reference< css::xml::dom::XNode > xNode(xDeps->item(i)); + css::uno::Reference< css::xml::dom::XElement > xDep(xNode, css::uno::UNO_QUERY); + if (xDep.is()) { + // found valid blacklist dependency, import the node first and append it to the existing dependency node + css::uno::Reference< css::xml::dom::XNode > importedNode = xCurrentDescInfo->importNode(xNode, true); + xCurrentDeps->appendChild(importedNode); } } } diff --git a/desktop/source/deployment/registry/component/dp_component.cxx b/desktop/source/deployment/registry/component/dp_component.cxx index 997eb4106c8b..cdc840762068 100644 --- a/desktop/source/deployment/registry/component/dp_component.cxx +++ b/desktop/source/deployment/registry/component/dp_component.cxx @@ -723,117 +723,117 @@ void BackendImpl::unorc_verify_init( if (transientMode()) return; const ::osl::MutexGuard guard( getMutex() ); - if (! m_unorc_inited) + if ( m_unorc_inited) + return; + + // common rc: + ::ucbhelper::Content ucb_content; + if (create_ucb_content( + &ucb_content, + makeURL( getCachePath(), "unorc" ), + xCmdEnv, false /* no throw */ )) { - // common rc: - ::ucbhelper::Content ucb_content; - if (create_ucb_content( - &ucb_content, - makeURL( getCachePath(), "unorc" ), - xCmdEnv, false /* no throw */ )) + OUString line; + if (readLine( &line, "UNO_JAVA_CLASSPATH=", ucb_content, + RTL_TEXTENCODING_UTF8 )) { - OUString line; - if (readLine( &line, "UNO_JAVA_CLASSPATH=", ucb_content, - RTL_TEXTENCODING_UTF8 )) - { - sal_Int32 index = sizeof ("UNO_JAVA_CLASSPATH=") - 1; - do { - OUString token( line.getToken( 0, ' ', index ).trim() ); - if (!token.isEmpty()) + sal_Int32 index = sizeof ("UNO_JAVA_CLASSPATH=") - 1; + do { + OUString token( line.getToken( 0, ' ', index ).trim() ); + if (!token.isEmpty()) + { + if (create_ucb_content( + nullptr, expandUnoRcTerm(token), xCmdEnv, + false /* no throw */ )) { - if (create_ucb_content( - nullptr, expandUnoRcTerm(token), xCmdEnv, - false /* no throw */ )) - { - //The jar file may not exist anymore if a shared or bundled - //extension was removed, but it can still be in the unorc - //After running XExtensionManager::synchronize, the unorc is - //cleaned up - m_jar_typelibs.push_back( token ); - } + //The jar file may not exist anymore if a shared or bundled + //extension was removed, but it can still be in the unorc + //After running XExtensionManager::synchronize, the unorc is + //cleaned up + m_jar_typelibs.push_back( token ); } } - while (index >= 0); } - if (readLine( &line, "UNO_TYPES=", ucb_content, - RTL_TEXTENCODING_UTF8 )) { - sal_Int32 index = sizeof ("UNO_TYPES=") - 1; - do { - OUString token( line.getToken( 0, ' ', index ).trim() ); - if (!token.isEmpty()) + while (index >= 0); + } + if (readLine( &line, "UNO_TYPES=", ucb_content, + RTL_TEXTENCODING_UTF8 )) { + sal_Int32 index = sizeof ("UNO_TYPES=") - 1; + do { + OUString token( line.getToken( 0, ' ', index ).trim() ); + if (!token.isEmpty()) + { + if (token[ 0 ] == '?') + token = token.copy( 1 ); + if (create_ucb_content( + nullptr, expandUnoRcTerm(token), xCmdEnv, + false /* no throw */ )) { - if (token[ 0 ] == '?') - token = token.copy( 1 ); - if (create_ucb_content( - nullptr, expandUnoRcTerm(token), xCmdEnv, - false /* no throw */ )) - { - //The RDB file may not exist anymore if a shared or bundled - //extension was removed, but it can still be in the unorc. - //After running XExtensionManager::synchronize, the unorc is - //cleaned up - m_rdb_typelibs.push_back( token ); - } + //The RDB file may not exist anymore if a shared or bundled + //extension was removed, but it can still be in the unorc. + //After running XExtensionManager::synchronize, the unorc is + //cleaned up + m_rdb_typelibs.push_back( token ); } } - while (index >= 0); } - if (readLine( &line, "UNO_SERVICES=", ucb_content, - RTL_TEXTENCODING_UTF8 )) + while (index >= 0); + } + if (readLine( &line, "UNO_SERVICES=", ucb_content, + RTL_TEXTENCODING_UTF8 )) + { + // The UNO_SERVICES line always has the BNF form + // "UNO_SERVICES=" + // ("?$ORIGIN/" <common-rdb>)? -- first + // "${$ORIGIN/${_OS}_${_ARCH}rc:UNO_SERVICES}"? -- second + // ("?" ("BUNDLED_EXTENSIONS" | -- third + // "UNO_SHARED_PACKAGES_CACHE" | "UNO_USER_PACKAGES_CACHE") + // ...)* + // so can unambiguously be split into its three parts: + int state = 1; + for (sal_Int32 i = RTL_CONSTASCII_LENGTH("UNO_SERVICES="); + i >= 0;) { - // The UNO_SERVICES line always has the BNF form - // "UNO_SERVICES=" - // ("?$ORIGIN/" <common-rdb>)? -- first - // "${$ORIGIN/${_OS}_${_ARCH}rc:UNO_SERVICES}"? -- second - // ("?" ("BUNDLED_EXTENSIONS" | -- third - // "UNO_SHARED_PACKAGES_CACHE" | "UNO_USER_PACKAGES_CACHE") - // ...)* - // so can unambiguously be split into its three parts: - int state = 1; - for (sal_Int32 i = RTL_CONSTASCII_LENGTH("UNO_SERVICES="); - i >= 0;) + OUString token(line.getToken(0, ' ', i)); + if (!token.isEmpty()) { - OUString token(line.getToken(0, ' ', i)); - if (!token.isEmpty()) + if (state == 1 && token.match("?$ORIGIN/")) { - if (state == 1 && token.match("?$ORIGIN/")) - { - m_commonRDB_orig = token.copy( - RTL_CONSTASCII_LENGTH("?$ORIGIN/")); - state = 2; - } - else if ( state <= 2 && token == "${$ORIGIN/${_OS}_${_ARCH}rc:UNO_SERVICES}" ) - { - state = 3; - } - else + m_commonRDB_orig = token.copy( + RTL_CONSTASCII_LENGTH("?$ORIGIN/")); + state = 2; + } + else if ( state <= 2 && token == "${$ORIGIN/${_OS}_${_ARCH}rc:UNO_SERVICES}" ) + { + state = 3; + } + else + { + if (token[0] == '?') { - if (token[0] == '?') - { - token = token.copy(1); - } - m_components.push_back(token); - state = 3; + token = token.copy(1); } + m_components.push_back(token); + state = 3; } } } + } - // native rc: - if (create_ucb_content( - &ucb_content, - makeURL( getCachePath(), getPlatformString() + "rc"), - xCmdEnv, false /* no throw */ )) { - if (readLine( &line, "UNO_SERVICES=", ucb_content, - RTL_TEXTENCODING_UTF8 )) { - m_nativeRDB_orig = line.copy( - sizeof ("UNO_SERVICES=?$ORIGIN/") - 1 ); - } + // native rc: + if (create_ucb_content( + &ucb_content, + makeURL( getCachePath(), getPlatformString() + "rc"), + xCmdEnv, false /* no throw */ )) { + if (readLine( &line, "UNO_SERVICES=", ucb_content, + RTL_TEXTENCODING_UTF8 )) { + m_nativeRDB_orig = line.copy( + sizeof ("UNO_SERVICES=?$ORIGIN/") - 1 ); } } - m_unorc_modified = false; - m_unorc_inited = true; } + m_unorc_modified = false; + m_unorc_inited = true; } @@ -1184,27 +1184,27 @@ void BackendImpl::ComponentPackageImpl::componentLiveInsertion( SAL_WARN("desktop.deployment", "implementation already registered " << implementationName); } } - if (!data.singletons.empty()) { - css::uno::Reference< css::container::XNameContainer > cont( - rootContext, css::uno::UNO_QUERY_THROW); - for (auto const& singleton : data.singletons) - { - OUString name("/singletons/" + singleton.first); - //TODO: Update should be atomic: - try { - cont->removeByName( name + "/arguments"); - } catch (const container::NoSuchElementException &) {} - try { - cont->insertByName( name + "/service", css::uno::Any(singleton.second)); - } catch (const container::ElementExistException &) { - cont->replaceByName( name + "/service", css::uno::Any(singleton.second)); - } - try { - cont->insertByName(name, css::uno::Any()); - } catch (const container::ElementExistException &) { - SAL_WARN("desktop.deployment", "singleton already registered " << singleton.first); - cont->replaceByName(name, css::uno::Any()); - } + if (data.singletons.empty()) return; + + css::uno::Reference< css::container::XNameContainer > cont( + rootContext, css::uno::UNO_QUERY_THROW); + for (auto const& singleton : data.singletons) + { + OUString name("/singletons/" + singleton.first); + //TODO: Update should be atomic: + try { + cont->removeByName( name + "/arguments"); + } catch (const container::NoSuchElementException &) {} + try { + cont->insertByName( name + "/service", css::uno::Any(singleton.second)); + } catch (const container::ElementExistException &) { + cont->replaceByName( name + "/service", css::uno::Any(singleton.second)); + } + try { + cont->insertByName(name, css::uno::Any()); + } catch (const container::ElementExistException &) { + SAL_WARN("desktop.deployment", "singleton already registered " << singleton.first); + cont->replaceByName(name, css::uno::Any()); } } } @@ -1224,23 +1224,24 @@ void BackendImpl::ComponentPackageImpl::componentLiveRemoval( // ignore if factory has not been live deployed } } - if (!data.singletons.empty()) { - css::uno::Reference< css::container::XNameContainer > cont( - rootContext, css::uno::UNO_QUERY_THROW); - for (auto const& singleton : data.singletons) - { - OUString name("/singletons/" + singleton.first); - //TODO: Removal should be atomic: - try { - cont->removeByName(name); - } catch (const container::NoSuchElementException &) {} - try { - cont->removeByName( name + "/service" ); - } catch (const container::NoSuchElementException &) {} - try { - cont->removeByName( name + "/arguments" ); - } catch (const container::NoSuchElementException &) {} - } + if (data.singletons.empty()) + return; + + css::uno::Reference< css::container::XNameContainer > cont( + rootContext, css::uno::UNO_QUERY_THROW); + for (auto const& singleton : data.singletons) + { + OUString name("/singletons/" + singleton.first); + //TODO: Removal should be atomic: + try { + cont->removeByName(name); + } catch (const container::NoSuchElementException &) {} + try { + cont->removeByName( name + "/service" ); + } catch (const container::NoSuchElementException &) {} + try { + cont->removeByName( name + "/arguments" ); + } catch (const container::NoSuchElementException &) {} } } diff --git a/desktop/source/deployment/registry/configuration/dp_configuration.cxx b/desktop/source/deployment/registry/configuration/dp_configuration.cxx index 9b7d4386fec5..ee1d6eb49886 100644 --- a/desktop/source/deployment/registry/configuration/dp_configuration.cxx +++ b/desktop/source/deployment/registry/configuration/dp_configuration.cxx @@ -350,54 +350,54 @@ void BackendImpl::configmgrini_verify_init( if (transientMode()) return; const ::osl::MutexGuard guard( getMutex() ); - if (! m_configmgrini_inited) + if ( m_configmgrini_inited) + return; + + // common rc: + ::ucbhelper::Content ucb_content; + if (create_ucb_content( + &ucb_content, + makeURL( getCachePath(), "configmgr.ini" ), + xCmdEnv, false /* no throw */ )) { - // common rc: - ::ucbhelper::Content ucb_content; - if (create_ucb_content( - &ucb_content, - makeURL( getCachePath(), "configmgr.ini" ), - xCmdEnv, false /* no throw */ )) + OUString line; + if (readLine( &line, "SCHEMA=", ucb_content, + RTL_TEXTENCODING_UTF8 )) { - OUString line; - if (readLine( &line, "SCHEMA=", ucb_content, - RTL_TEXTENCODING_UTF8 )) - { - sal_Int32 index = RTL_CONSTASCII_LENGTH("SCHEMA="); - do { - OUString token( line.getToken( 0, ' ', index ).trim() ); - if (!token.isEmpty()) { - //The file may not exist anymore if a shared or bundled - //extension was removed, but it can still be in the configmgrini. - //After running XExtensionManager::synchronize, the configmgrini is - //cleaned up - m_xcs_files.push_back( token ); - } + sal_Int32 index = RTL_CONSTASCII_LENGTH("SCHEMA="); + do { + OUString token( line.getToken( 0, ' ', index ).trim() ); + if (!token.isEmpty()) { + //The file may not exist anymore if a shared or bundled + //extension was removed, but it can still be in the configmgrini. + //After running XExtensionManager::synchronize, the configmgrini is + //cleaned up + m_xcs_files.push_back( token ); } - while (index >= 0); } - if (readLine( &line, "DATA=", ucb_content, - RTL_TEXTENCODING_UTF8 )) { - sal_Int32 index = RTL_CONSTASCII_LENGTH("DATA="); - do { - OUString token( line.getToken( 0, ' ', index ).trim() ); - if (!token.isEmpty()) - { - if (token[ 0 ] == '?') - token = token.copy( 1 ); - //The file may not exist anymore if a shared or bundled - //extension was removed, but it can still be in the configmgrini. - //After running XExtensionManager::synchronize, the configmgrini is - //cleaned up - m_xcu_files.push_back( token ); - } + while (index >= 0); + } + if (readLine( &line, "DATA=", ucb_content, + RTL_TEXTENCODING_UTF8 )) { + sal_Int32 index = RTL_CONSTASCII_LENGTH("DATA="); + do { + OUString token( line.getToken( 0, ' ', index ).trim() ); + if (!token.isEmpty()) + { + if (token[ 0 ] == '?') + token = token.copy( 1 ); + //The file may not exist anymore if a shared or bundled + //extension was removed, but it can still be in the configmgrini. + //After running XExtensionManager::synchronize, the configmgrini is + //cleaned up + m_xcu_files.push_back( token ); } - while (index >= 0); } + while (index >= 0); } - m_configmgrini_modified = false; - m_configmgrini_inited = true; } + m_configmgrini_modified = false; + m_configmgrini_inited = true; } diff --git a/desktop/source/deployment/registry/dp_backend.cxx b/desktop/source/deployment/registry/dp_backend.cxx index 0dab3ad8d69b..e6339def509a 100644 --- a/desktop/source/deployment/registry/dp_backend.cxx +++ b/desktop/source/deployment/registry/dp_backend.cxx @@ -553,17 +553,18 @@ void Package::fireModified() { ::cppu::OInterfaceContainerHelper * container = rBHelper.getContainer( cppu::UnoType<util::XModifyListener>::get() ); - if (container != nullptr) { - Sequence< Reference<XInterface> > elements( - container->getElements() ); - lang::EventObject evt( static_cast<OWeakObject *>(this) ); - for ( sal_Int32 pos = 0; pos < elements.getLength(); ++pos ) - { - Reference<util::XModifyListener> xListener( - elements[ pos ], UNO_QUERY ); - if (xListener.is()) - xListener->modified( evt ); - } + if (container == nullptr) + return; + + Sequence< Reference<XInterface> > elements( + container->getElements() ); + lang::EventObject evt( static_cast<OWeakObject *>(this) ); + for ( sal_Int32 pos = 0; pos < elements.getLength(); ++pos ) + { + Reference<util::XModifyListener> xListener( + elements[ pos ], UNO_QUERY ); + if (xListener.is()) + xListener->modified( evt ); } } diff --git a/desktop/source/deployment/registry/help/dp_help.cxx b/desktop/source/deployment/registry/help/dp_help.cxx index 27cf615eb41b..eddb42b28a40 100644 --- a/desktop/source/deployment/registry/help/dp_help.cxx +++ b/desktop/source/deployment/registry/help/dp_help.cxx @@ -129,20 +129,20 @@ BackendImpl::BackendImpl( m_typeInfos( 1 ) { m_typeInfos[ 0 ] = m_xHelpTypeInfo; - if (!transientMode()) - { - OUString dbFile = makeURL(getCachePath(), "backenddb.xml"); - m_backendDb.reset( - new HelpBackendDb(getComponentContext(), dbFile)); - - //clean up data folders which are no longer used. - //This must not be done in the same process where the help files - //are still registers. Only after revoking and restarting OOo the folders - //can be removed. This works now, because the extension manager is a singleton - //and the backends are only create once per process. - std::vector<OUString> folders = m_backendDb->getAllDataUrls(); - deleteUnusedFolders(folders); - } + if (transientMode()) + return; + + OUString dbFile = makeURL(getCachePath(), "backenddb.xml"); + m_backendDb.reset( + new HelpBackendDb(getComponentContext(), dbFile)); + + //clean up data folders which are no longer used. + //This must not be done in the same process where the help files + //are still registers. Only after revoking and restarting OOo the folders + //can be removed. This works now, because the extension manager is a singleton + //and the backends are only create once per process. + std::vector<OUString> folders = m_backendDb->getAllDataUrls(); + deleteUnusedFolders(folders); } // XPackageRegistry diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx index 9cc78c7e6bc3..ce8fe18a44c0 100644 --- a/desktop/source/deployment/registry/package/dp_package.cxx +++ b/desktop/source/deployment/registry/package/dp_package.cxx @@ -1454,28 +1454,28 @@ void BackendImpl::PackageImpl::scanBundle( } } - if (!descrFile.isEmpty()) + if (descrFile.isEmpty()) + return; + + ::ucbhelper::Content descrFileContent; + if (!create_ucb_content( &descrFileContent, descrFile, + xCmdEnv, false /* no throw */ )) + return; + + // patch description: + std::vector<sal_Int8> bytes( readFile( descrFileContent ) ); + OUStringBuffer buf; + if ( !bytes.empty() ) { - ::ucbhelper::Content descrFileContent; - if (create_ucb_content( &descrFileContent, descrFile, - xCmdEnv, false /* no throw */ )) - { - // patch description: - std::vector<sal_Int8> bytes( readFile( descrFileContent ) ); - OUStringBuffer buf; - if ( !bytes.empty() ) - { - buf.append( OUString( reinterpret_cast<char const *>( - bytes.data() ), - bytes.size(), RTL_TEXTENCODING_UTF8 ) ); - } - else - { - buf.append( Package::getDescription() ); - } - m_oldDescription = buf.makeStringAndClear(); - } + buf.append( OUString( reinterpret_cast<char const *>( + bytes.data() ), + bytes.size(), RTL_TEXTENCODING_UTF8 ) ); + } + else + { + buf.append( Package::getDescription() ); } + m_oldDescription = buf.makeStringAndClear(); } diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index a8bf2cb94042..8f42bd2883a4 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1877,65 +1877,65 @@ void CallbackFlushHandler::Invoke() { comphelper::ProfileZone aZone("CallbackFlushHander::Invoke"); - if (m_pCallback) + if (!m_pCallback) + return; + + std::scoped_lock<std::mutex> lock(m_mutex); + + SAL_INFO("lok", "Flushing " << m_queue.size() << " elements."); + for (const auto& rCallbackData : m_queue) { - std::scoped_lock<std::mutex> lock(m_mutex); + const int type = rCallbackData.Type; + const auto& payload = rCallbackData.PayloadString; + const int viewId = lcl_isViewCallbackType(type) ? lcl_getViewId(rCallbackData) : -1; - SAL_INFO("lok", "Flushing " << m_queue.size() << " elements."); - for (const auto& rCallbackData : m_queue) + if (viewId == -1) { - const int type = rCallbackData.Type; - const auto& payload = rCallbackData.PayloadString; - const int viewId = lcl_isViewCallbackType(type) ? lcl_getViewId(rCallbackData) : -1; + const auto stateIt = m_states.find(type); + if (stateIt != m_states.end()) + { + // If the state didn't change, it's safe to ignore. + if (stateIt->second == payload) + { + SAL_INFO("lok", "Skipping duplicate [" << type << "]: [" << payload << "]."); + continue; + } - if (viewId == -1) + stateIt->second = payload; + } + } + else + { + const auto statesIt = m_viewStates.find(viewId); + if (statesIt != m_viewStates.end()) { - const auto stateIt = m_states.find(type); - if (stateIt != m_states.end()) + auto& states = statesIt->second; + const auto stateIt = states.find(type); + if (stateIt != states.end()) { // If the state didn't change, it's safe to ignore. if (stateIt->second == payload) { - SAL_INFO("lok", "Skipping duplicate [" << type << "]: [" << payload << "]."); + SAL_INFO("lok", "Skipping view duplicate [" << type << ',' << viewId << "]: [" << payload << "]."); continue; } + SAL_INFO("lok", "Replacing an element in view states [" << type << ',' << viewId << "]: [" << payload << "]."); stateIt->second = payload; } - } - else - { - const auto statesIt = m_viewStates.find(viewId); - if (statesIt != m_viewStates.end()) + else { - auto& states = statesIt->second; - const auto stateIt = states.find(type); - if (stateIt != states.end()) - { - // If the state didn't change, it's safe to ignore. - if (stateIt->second == payload) - { - SAL_INFO("lok", "Skipping view duplicate [" << type << ',' << viewId << "]: [" << payload << "]."); - continue; - } - - SAL_INFO("lok", "Replacing an element in view states [" << type << ',' << viewId << "]: [" << payload << "]."); - stateIt->second = payload; - } - else - { - SAL_INFO("lok", "Inserted a new element in view states: [" << type << ',' << viewId << "]: [" << payload << "]"); - states.emplace(type, payload); + SAL_INFO("lok", "Inserted a new element in view states: [" << type << ',' << viewId << "]: [" << payload << "]"); + states.emplace(type, payload); - } } } - - m_pCallback(type, payload.c_str(), m_pData); } - m_queue.clear(); + m_pCallback(type, payload.c_str(), m_pData); } + + m_queue.clear(); } bool CallbackFlushHandler::removeAll(const std::function<bool (const CallbackFlushHandler::queue_type::value_type&)>& rTestFunc) diff --git a/desktop/source/migration/services/jvmfwk.cxx b/desktop/source/migration/services/jvmfwk.cxx index a4fe6aaaf09d..20a7c2ff2da3 100644 --- a/desktop/source/migration/services/jvmfwk.cxx +++ b/desktop/source/migration/services/jvmfwk.cxx @@ -234,27 +234,27 @@ void JavaMigration::migrateJavarc() bool bSuccess = javaini.getFrom("Home", sValue); OSL_ENSURE(bSuccess, "[Service implementation " IMPL_NAME "] XJob::execute: Could not get Home entry from java.ini/javarc."); - if (bSuccess && !sValue.isEmpty()) - { - //get the directory - std::unique_ptr<JavaInfo> aInfo; - javaFrameworkError err = jfw_getJavaInfoByPath(sValue, &aInfo); + if (!(bSuccess && !sValue.isEmpty())) + return; - if (err == JFW_E_NONE) - { - if (jfw_setSelectedJRE(aInfo.get()) != JFW_E_NONE) - { - OSL_FAIL("[Service implementation " IMPL_NAME - "] XJob::execute: jfw_setSelectedJRE failed."); - fprintf(stderr, "\nCannot migrate Java. An error occurred.\n"); - } - } - else if (err == JFW_E_FAILED_VERSION) + //get the directory + std::unique_ptr<JavaInfo> aInfo; + javaFrameworkError err = jfw_getJavaInfoByPath(sValue, &aInfo); + + if (err == JFW_E_NONE) + { + if (jfw_setSelectedJRE(aInfo.get()) != JFW_E_NONE) { - fprintf(stderr, "\nCannot migrate Java settings because the version of the Java " - "is not supported anymore.\n"); + OSL_FAIL("[Service implementation " IMPL_NAME + "] XJob::execute: jfw_setSelectedJRE failed."); + fprintf(stderr, "\nCannot migrate Java. An error occurred.\n"); } } + else if (err == JFW_E_FAILED_VERSION) + { + fprintf(stderr, "\nCannot migrate Java settings because the version of the Java " + "is not supported anymore.\n"); + } } @@ -312,41 +312,41 @@ void SAL_CALL JavaMigration::overrideProperty( void SAL_CALL JavaMigration::setPropertyValue( const Any& aValue ) { - if ( !m_aStack.empty()) - { - switch (m_aStack.top().second) - { - case ENABLE_JAVA: - { - bool val; - if (!(aValue >>= val)) - throw MalformedDataException( - "[Service implementation " IMPL_NAME - "] XLayerHandler::setPropertyValue received wrong type for Enable property", nullptr, Any()); - if (jfw_setEnabled(val) != JFW_E_NONE) - throw WrappedTargetException( - "[Service implementation " IMPL_NAME - "] XLayerHandler::setPropertyValue: jfw_setEnabled failed.", nullptr, Any()); + if ( m_aStack.empty()) + return; - break; - } - case USER_CLASS_PATH: - { - OUString cp; - if (!(aValue >>= cp)) - throw MalformedDataException( - "[Service implementation " IMPL_NAME - "] XLayerHandler::setPropertyValue received wrong type for UserClassPath property", nullptr, Any()); - - if (jfw_setUserClassPath(cp) != JFW_E_NONE) - throw WrappedTargetException( + switch (m_aStack.top().second) + { + case ENABLE_JAVA: + { + bool val; + if (!(aValue >>= val)) + throw MalformedDataException( + "[Service implementation " IMPL_NAME + "] XLayerHandler::setPropertyValue received wrong type for Enable property", nullptr, Any()); + if (jfw_setEnabled(val) != JFW_E_NONE) + throw WrappedTargetException( + "[Service implementation " IMPL_NAME + "] XLayerHandler::setPropertyValue: jfw_setEnabled failed.", nullptr, Any()); + + break; + } + case USER_CLASS_PATH: + { + OUString cp; + if (!(aValue >>= cp)) + throw MalformedDataException( "[Service implementation " IMPL_NAME - "] XLayerHandler::setPropertyValue: jfw_setUserClassPath failed.", nullptr, Any()); - break; - } - default: - OSL_ASSERT(false); - } + "] XLayerHandler::setPropertyValue received wrong type for UserClassPath property", nullptr, Any()); + + if (jfw_setUserClassPath(cp) != JFW_E_NONE) + throw WrappedTargetException( + "[Service implementation " IMPL_NAME + "] XLayerHandler::setPropertyValue: jfw_setUserClassPath failed.", nullptr, Any()); + break; + } + default: + OSL_ASSERT(false); } } diff --git a/desktop/source/migration/services/oo3extensionmigration.cxx b/desktop/source/migration/services/oo3extensionmigration.cxx index 979ab8dacce4..aec9fe05105e 100644 --- a/desktop/source/migration/services/oo3extensionmigration.cxx +++ b/desktop/source/migration/services/oo3extensionmigration.cxx @@ -78,37 +78,37 @@ void OO3ExtensionMigration::scanUserExtensions( const OUString& sSourceDir, TStr osl::Directory aScanRootDir( sSourceDir ); osl::FileStatus fs(osl_FileStatus_Mask_Type | osl_FileStatus_Mask_FileURL); osl::FileBase::RC nRetCode = aScanRootDir.open(); - if ( nRetCode == osl::Directory::E_None ) + if ( nRetCode != osl::Directory::E_None ) + return; + + sal_uInt32 nHint( 0 ); + osl::DirectoryItem aItem; + while ( aScanRootDir.getNextItem( aItem, nHint ) == osl::Directory::E_None ) { - sal_uInt32 nHint( 0 ); - osl::DirectoryItem aItem; - while ( aScanRootDir.getNextItem( aItem, nHint ) == osl::Directory::E_None ) + if (( aItem.getFileStatus(fs) == osl::FileBase::E_None ) && + ( fs.getFileType() == osl::FileStatus::Directory )) { - if (( aItem.getFileStatus(fs) == osl::FileBase::E_None ) && - ( fs.getFileType() == osl::FileStatus::Directory )) - { - //Check next folder as the "real" extension folder is below a temp folder! - OUString sExtensionFolderURL = fs.getFileURL(); + //Check next folder as the "real" extension folder is below a temp folder! + OUString sExtensionFolderURL = fs.getFileURL(); - osl::Directory aExtensionRootDir( sExtensionFolderURL ); + osl::Directory aExtensionRootDir( sExtensionFolderURL ); - nRetCode = aExtensionRootDir.open(); - if ( nRetCode == osl::Directory::E_None ) + nRetCode = aExtensionRootDir.open(); + if ( nRetCode == osl::Directory::E_None ) + { + osl::DirectoryItem aExtDirItem; + while ( aExtensionRootDir.getNextItem( aExtDirItem, nHint ) == osl::Directory::E_None ) { - osl::DirectoryItem aExtDirItem; - while ( aExtensionRootDir.getNextItem( aExtDirItem, nHint ) == osl::Directory::E_None ) + bool bFileStatus = aExtDirItem.getFileStatus(fs) == osl::FileBase::E_None; + bool bIsDir = fs.getFileType() == osl::FileStatus::Directory; + + if ( bFileStatus && bIsDir ) { - bool bFileStatus = aExtDirItem.getFileStatus(fs) == osl::FileBase::E_None; - bool bIsDir = fs.getFileType() == osl::FileStatus::Directory; - - if ( bFileStatus && bIsDir ) - { - sExtensionFolderURL = fs.getFileURL(); - ScanResult eResult = scanExtensionFolder( sExtensionFolderURL ); - if ( eResult == SCANRESULT_MIGRATE_EXTENSION ) - aMigrateExtensions.push_back( sExtensionFolderURL ); - break; - } + sExtensionFolderURL = fs.getFileURL(); + ScanResult eResult = scanExtensionFolder( sExtensionFolderURL ); + if ( eResult == SCANRESULT_MIGRATE_EXTENSION ) + aMigrateExtensions.push_back( sExtensionFolderURL ); + break; } } } diff --git a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx index df276342b765..ecbb122f8dd1 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx @@ -272,18 +272,19 @@ void printf_package( printf_line( "Media-Type", xPackageType->getMediaType(), level + 1 ); } printf_line( "Description", xPackage->getDescription(), level + 1 ); - if (xPackage->isBundle()) { - Sequence< Reference<deployment::XPackage> > seq( - xPackage->getBundle( Reference<task::XAbortChannel>(), xCmdEnv ) ); - printf_space( level + 1 ); - dp_misc::writeConsole("bundled Packages: {\n"); - std::vector<Reference<deployment::XPackage> >vec_bundle; - ::comphelper::sequenceToContainer(vec_bundle, seq); - printf_packages( vec_bundle, std::vector<bool>(vec_bundle.size()), - xCmdEnv, level + 2 ); - printf_space( level + 1 ); - dp_misc::writeConsole("}\n"); - } + if (!xPackage->isBundle()) + return; + + Sequence< Reference<deployment::XPackage> > seq( + xPackage->getBundle( Reference<task::XAbortChannel>(), xCmdEnv ) ); + printf_space( level + 1 ); + dp_misc::writeConsole("bundled Packages: {\n"); + std::vector<Reference<deployment::XPackage> >vec_bundle; + ::comphelper::sequenceToContainer(vec_bundle, seq); + printf_packages( vec_bundle, std::vector<bool>(vec_bundle.size()), + xCmdEnv, level + 2 ); + printf_space( level + 1 ); + dp_misc::writeConsole("}\n"); } } // anon namespace diff --git a/desktop/source/splash/splash.cxx b/desktop/source/splash/splash.cxx index 8969ca94dab1..bb90234881f7 100644 --- a/desktop/source/splash/splash.cxx +++ b/desktop/source/splash/splash.cxx @@ -245,67 +245,67 @@ void SAL_CALL SplashScreen::initialize( const css::uno::Sequence< css::uno::Any>& aArguments ) { osl::MutexGuard aGuard( _aMutex ); - if (aArguments.hasElements()) + if (!aArguments.hasElements()) + return; + + aArguments[0] >>= _bVisible; + if (aArguments.getLength() > 1 ) + aArguments[1] >>= _sAppName; + + // start to determine bitmap and all other required value + if ( _bShowLogo ) + SetScreenBitmap (_aIntroBmp); + Size aSize = _aIntroBmp.GetSizePixel(); + pWindow->SetOutputSizePixel( aSize ); + pWindow->_vdev->SetOutputSizePixel( aSize ); + _height = aSize.Height(); + _width = aSize.Width(); + if (_width > 500) { - aArguments[0] >>= _bVisible; - if (aArguments.getLength() > 1 ) - aArguments[1] >>= _sAppName; - - // start to determine bitmap and all other required value - if ( _bShowLogo ) - SetScreenBitmap (_aIntroBmp); - Size aSize = _aIntroBmp.GetSizePixel(); - pWindow->SetOutputSizePixel( aSize ); - pWindow->_vdev->SetOutputSizePixel( aSize ); - _height = aSize.Height(); - _width = aSize.Width(); - if (_width > 500) + Point xtopleft(212,216); + if ( NOT_LOADED == _tlx || NOT_LOADED == _tly ) { - Point xtopleft(212,216); - if ( NOT_LOADED == _tlx || NOT_LOADED == _tly ) - { - _tlx = xtopleft.X(); // top-left x - _tly = xtopleft.Y(); // top-left y - } - if ( NOT_LOADED == _barwidth ) - _barwidth = 263; - if ( NOT_LOADED == _barheight ) - _barheight = 8; + _tlx = xtopleft.X(); // top-left x + _tly = xtopleft.Y(); // top-left y } - else + if ( NOT_LOADED == _barwidth ) + _barwidth = 263; + if ( NOT_LOADED == _barheight ) + _barheight = 8; + } + else + { + if ( NOT_LOADED == _barwidth ) + _barwidth = _width - (2 * _xoffset); + if ( NOT_LOADED == _barheight ) + _barheight = 6; + if ( NOT_LOADED == _tlx || NOT_LOADED == _tly ) { - if ( NOT_LOADED == _barwidth ) - _barwidth = _width - (2 * _xoffset); - if ( NOT_LOADED == _barheight ) - _barheight = 6; - if ( NOT_LOADED == _tlx || NOT_LOADED == _tly ) - { - _tlx = _xoffset; // top-left x - _tly = _height - _yoffset; // top-left y - } + _tlx = _xoffset; // top-left x + _tly = _height - _yoffset; // top-left y } + } - if ( NOT_LOADED == _textBaseline ) - _textBaseline = _height; + if ( NOT_LOADED == _textBaseline ) + _textBaseline = _height; - if ( NOT_LOADED_COLOR == _cProgressFrameColor ) - _cProgressFrameColor = COL_LIGHTGRAY; + if ( NOT_LOADED_COLOR == _cProgressFrameColor ) + _cProgressFrameColor = COL_LIGHTGRAY; - if ( NOT_LOADED_COLOR == _cProgressBarColor ) - { - // progress bar: new color only for big bitmap format - if ( _width > 500 ) - _cProgressBarColor = Color( 157, 202, 18 ); - else - _cProgressBarColor = COL_BLUE; - } + if ( NOT_LOADED_COLOR == _cProgressBarColor ) + { + // progress bar: new color only for big bitmap format + if ( _width > 500 ) + _cProgressBarColor = Color( 157, 202, 18 ); + else + _cProgressBarColor = COL_BLUE; + } - if ( NOT_LOADED_COLOR == _cProgressTextColor ) - _cProgressTextColor = COL_BLACK; + if ( NOT_LOADED_COLOR == _cProgressTextColor ) + _cProgressTextColor = COL_BLACK; - Application::AddEventListener( - LINK( this, SplashScreen, AppEventListenerHdl ) ); - } + Application::AddEventListener( + LINK( this, SplashScreen, AppEventListenerHdl ) ); } void SplashScreen::updateStatus() diff --git a/desktop/unx/source/splashx.c b/desktop/unx/source/splashx.c index d759ed3a4816..afd137d06876 100644 --- a/desktop/unx/source/splashx.c +++ b/desktop/unx/source/splashx.c @@ -727,22 +727,22 @@ void splash_draw_progress( struct splash* splash, int progress ) void splash_destroy(struct splash* splash) { - if(splash) + if(!splash) + return; + + if(splash->display) { - if(splash->display) + if(splash->gc) { - if(splash->gc) - { - XFreeGC(splash->display, splash->gc); - splash->gc = NULL; - } - - XCloseDisplay( splash->display ); - splash->display = NULL; - png_destroy_read_struct( &(splash->png_ptr), &(splash->info_ptr), NULL ); + XFreeGC(splash->display, splash->gc); + splash->gc = NULL; } - free(splash); + + XCloseDisplay( splash->display ); + splash->display = NULL; + png_destroy_read_struct( &(splash->png_ptr), &(splash->info_ptr), NULL ); } + free(splash); } struct splash* splash_create(rtl_uString* pAppPath, int argc, char** argv) |