diff options
author | Tor Lillqvist <tlillqvist@novell.com> | 2011-02-16 09:18:28 +0200 |
---|---|---|
committer | Tor Lillqvist <tlillqvist@novell.com> | 2011-02-18 11:44:44 +0200 |
commit | 33fa50e1191c75fd2fcbf6f852ec1d76af58a577 (patch) | |
tree | e64f117a32f0c30ecf6cf1b152a915a2d6133124 /framework/source/services | |
parent | d73b8d1054d3ee3b6ff289f7a3ad6b6833e5bda6 (diff) |
Drop some pointless assertions
Diffstat (limited to 'framework/source/services')
-rw-r--r-- | framework/source/services/desktop.cxx | 17 | ||||
-rw-r--r-- | framework/source/services/substitutepathvars.cxx | 15 |
2 files changed, 23 insertions, 9 deletions
diff --git a/framework/source/services/desktop.cxx b/framework/source/services/desktop.cxx index 4d4bb7475e68..1dfa1b4cca56 100644 --- a/framework/source/services/desktop.cxx +++ b/framework/source/services/desktop.cxx @@ -283,7 +283,14 @@ Desktop::Desktop( const css::uno::Reference< css::lang::XMultiServiceFactory >& *//*-*************************************************************************************************************/ Desktop::~Desktop() { - LOG_ASSERT2( m_bIsTerminated ==sal_False, "Desktop::~Desktop()", "Who forgot to terminate the desktop service?" ) +#ifdef ENABLE_ASSERTIONS + // Perhaps we should here do use a real assertion, but make the + // condition more specific? We don't want it to fire in unit tests + // in sc/qa/unit for instance, that don't even have any GUI. + if( !m_bIsTerminated ) + fprintf( stderr, "This used to be an assertion failure: Desktop not terminated before being destructed,\n" + "but it is probably not a real problem.\n" ); +#endif LOG_ASSERT2( m_aTransactionManager.getWorkingMode()!=E_CLOSE , "Desktop::~Desktop()", "Who forgot to dispose this service?" ) } @@ -1178,8 +1185,14 @@ void SAL_CALL Desktop::dispose() { // Safe impossible cases // It's an programming error if dispose is called before terminate! - LOG_ASSERT2( m_bIsTerminated==sal_False, "Desktop::dispose()", "It's not allowed to dispose the desktop before terminate() is called!" ) + // But if you just ignore the assertion (which happens in unit + // tests for instance in sc/qa/unit) nothing bad happens. +#ifdef ENABLE_ASSERTIONS + if( !m_bIsTerminated ) + fprintf( stderr, "This used to be an assertion failure: Desktop disposed before terminating it,\n" + "but nothing bad seems to happen anyway?\n" ); +#endif SYNCHRONIZED_START WriteGuard aWriteLock( m_aLock ); diff --git a/framework/source/services/substitutepathvars.cxx b/framework/source/services/substitutepathvars.cxx index 22989307147a..9c881abbdc51 100644 --- a/framework/source/services/substitutepathvars.cxx +++ b/framework/source/services/substitutepathvars.cxx @@ -1188,9 +1188,9 @@ void SubstitutePathVariables::SetPredefinedPathVariables( PredefinedPathVariable if( aState == ::utl::Bootstrap::PATH_EXISTS ) { aPreDefPathVariables.m_FixedVar[ PREDEFVAR_USERPATH ] = ConvertOSLtoUCBURL( sVal ); } - else { - LOG_ERROR( "SubstitutePathVariables::SetPredefinedPathVariables", "Bootstrap code has no value for userpath"); - } + // We use to have a LOG_ERROR here in an else branch, but that + // always fired in some unit tests, and if you then just ignored + // it, nothing bad happened, so it seems fairly pointless. // Set $(inst), $(instpath), $(insturl) aPreDefPathVariables.m_FixedVar[ PREDEFVAR_INSTURL ] = aPreDefPathVariables.m_FixedVar[ PREDEFVAR_INSTPATH ]; @@ -1222,10 +1222,11 @@ void SubstitutePathVariables::SetPredefinedPathVariables( PredefinedPathVariable rtl::OUString aLocaleStr; if ( utl::ConfigManager::GetConfigManager().GetDirectConfigProperty( utl::ConfigManager::LOCALE ) >>= aLocaleStr ) aPreDefPathVariables.m_eLanguageType = MsLangId::convertIsoStringToLanguage( aLocaleStr ); - else - { - LOG_ERROR( "SubstitutePathVariables::SetPredefinedPathVariables", "Wrong Any type for language!" ); - } + // We used to have an else branch here with a LOG_ERROR, but that + // always fired in some unit tests when this code was built with + // debug=t, so it seems fairly pointless, especially as + // aPreDefPathVariables.m_eLanguageType has been initialized to a + // default value above anyway. // Set $(lang) aPreDefPathVariables.m_FixedVar[ PREDEFVAR_LANG ] = ConvertOSLtoUCBURL( |