[Libreoffice-commits] core.git: 2 commits - desktop/source libreofficekit/qa sal/osl
Tor Lillqvist
tml at collabora.com
Thu Apr 9 13:47:07 PDT 2015
desktop/source/app/check_ext_deps.cxx | 4 +-
desktop/source/deployment/misc/dp_misc.cxx | 4 +-
libreofficekit/qa/unit/tiledrendering.cxx | 3 -
sal/osl/unx/mutex.cxx | 48 +++++++++++++++--------------
4 files changed, 29 insertions(+), 30 deletions(-)
New commits:
commit 72e7bf859df4941e7c86b57d12a4a2254b202ac1
Author: Tor Lillqvist <tml at collabora.com>
Date: Thu Apr 9 20:28:18 2015 +0300
Use comphelper::LibreOfficeKit::isActive() instead of LOK_TEST env var
Change-Id: Iaa0c751f101df6db25e9fca9123b81ac63033159
diff --git a/desktop/source/app/check_ext_deps.cxx b/desktop/source/app/check_ext_deps.cxx
index 04896a4..8145db1 100644
--- a/desktop/source/app/check_ext_deps.cxx
+++ b/desktop/source/app/check_ext_deps.cxx
@@ -33,6 +33,7 @@
#include <unotools/configmgr.hxx>
#include <toolkit/helper/vclunohelper.hxx>
+#include <comphelper/lok.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/sequence.hxx>
#include <cppuhelper/bootstrap.hxx>
@@ -421,8 +422,7 @@ void Desktop::SynchronizeExtensionRepositories()
deployment::ExtensionManager::get(context)->reinstallDeployedExtensions(
true, "user", Reference<task::XAbortChannel>(), silent);
#if !HAVE_FEATURE_MACOSX_SANDBOX
- // getenv is a hack to detect if we're running in a LOK unit test
- if (!getenv("LOK_TEST"))
+ if (!comphelper::LibreOfficeKit::isActive())
task::OfficeRestartManager::get(context)->requestRestart(
silent->getInteractionHandler());
#endif
diff --git a/desktop/source/deployment/misc/dp_misc.cxx b/desktop/source/deployment/misc/dp_misc.cxx
index 60a0658..c5b4eec 100644
--- a/desktop/source/deployment/misc/dp_misc.cxx
+++ b/desktop/source/deployment/misc/dp_misc.cxx
@@ -42,6 +42,7 @@
#include <com/sun/star/task/OfficeRestartManager.hpp>
#include <boost/scoped_array.hpp>
#include <boost/shared_ptr.hpp>
+#include <comphelper/lok.hxx>
#include <comphelper/processfactory.hxx>
#include <salhelper/linkhelper.hxx>
@@ -558,8 +559,7 @@ void syncRepositories(
}
}
#if !HAVE_FEATURE_MACOSX_SANDBOX
- // getenv is a hack to detect if we're running in a LOK unit test
- if (bModified && !getenv("LOK_TEST"))
+ if (bModified && !comphelper::LibreOfficeKit::isActive())
{
Reference<task::XRestartManager> restarter(task::OfficeRestartManager::get(comphelper::getProcessComponentContext()));
if (restarter.is())
diff --git a/libreofficekit/qa/unit/tiledrendering.cxx b/libreofficekit/qa/unit/tiledrendering.cxx
index 7c956e6..0d33097 100644
--- a/libreofficekit/qa/unit/tiledrendering.cxx
+++ b/libreofficekit/qa/unit/tiledrendering.cxx
@@ -84,9 +84,6 @@ void TiledRenderingTest::runAllTests()
OUString sUserInstallURL = aWorkdirRootURL + "/unittest";
rtl::Bootstrap::set(OUString("UserInstallation"), sUserInstallURL);
- // No restart in desktop.
- setenv("LOK_TEST", "1", true);
-
scoped_ptr< Office > pOffice( lok_cpp_init(
m_sLOPath.c_str() ) );
CPPUNIT_ASSERT( pOffice.get() );
commit 2dede8bfbab5d353f91acc5f5fa7c21b1b1a4fea
Author: Tor Lillqvist <tml at collabora.com>
Date: Thu Apr 9 20:26:32 2015 +0300
Change from <osl/diagnose.h> to <sal/log.hxx> and add more logging
Change-Id: Iee8c093f5aa8306c3e5336d6dd5e801df6df87a4
diff --git a/sal/osl/unx/mutex.cxx b/sal/osl/unx/mutex.cxx
index 9a00475..4bc726d 100644
--- a/sal/osl/unx/mutex.cxx
+++ b/sal/osl/unx/mutex.cxx
@@ -25,8 +25,8 @@
#endif
#include "system.hxx"
+#include <sal/log.hxx>
#include <osl/mutex.h>
-#include <osl/diagnose.h>
#include <pthread.h>
#include <stdlib.h>
@@ -37,16 +37,13 @@ typedef struct _oslMutexImpl
pthread_mutex_t mutex;
} oslMutexImpl;
-/*****************************************************************************/
-/* osl_createMutex */
-/*****************************************************************************/
oslMutex SAL_CALL osl_createMutex()
{
oslMutexImpl* pMutex = static_cast<oslMutexImpl*>(malloc(sizeof(oslMutexImpl)));
pthread_mutexattr_t aMutexAttr;
int nRet=0;
- OSL_ASSERT(pMutex);
+ SAL_WARN_IF(!pMutex, "sal.osl.mutex", "null pMutex");
if ( pMutex == 0 )
{
@@ -60,8 +57,7 @@ oslMutex SAL_CALL osl_createMutex()
nRet = pthread_mutex_init(&(pMutex->mutex), &aMutexAttr);
if ( nRet != 0 )
{
- OSL_TRACE("osl_createMutex : mutex init/setattr failed. Errno: %d; %s\n",
- nRet, strerror(nRet));
+ SAL_WARN("sal.osl.mutex", "pthread_muxex_init failed: " << strerror(nRet));
free(pMutex);
pMutex = 0;
@@ -69,12 +65,16 @@ oslMutex SAL_CALL osl_createMutex()
pthread_mutexattr_destroy(&aMutexAttr);
+ SAL_INFO("sal.osl.mutex", "osl_createMutex(): " << pMutex);
+
return pMutex;
}
void SAL_CALL osl_destroyMutex(oslMutexImpl *pMutex)
{
- OSL_ASSERT(pMutex);
+ SAL_WARN_IF(!pMutex, "sal.osl.mutex", "null pMutex");
+
+ SAL_INFO("sal.osl.mutex", "osl_destroyMutex(" << pMutex << ")");
if ( pMutex != 0 )
{
@@ -83,8 +83,7 @@ void SAL_CALL osl_destroyMutex(oslMutexImpl *pMutex)
nRet = pthread_mutex_destroy(&(pMutex->mutex));
if ( nRet != 0 )
{
- OSL_TRACE("osl_destroyMutex : mutex destroy failed. Errno: %d; %s\n",
- nRet, strerror(nRet));
+ SAL_WARN("sal.osl.mutex", "pthread_mutex_destroy failed: " << strerror(nRet));
}
free(pMutex);
@@ -95,7 +94,9 @@ void SAL_CALL osl_destroyMutex(oslMutexImpl *pMutex)
sal_Bool SAL_CALL osl_acquireMutex(oslMutexImpl *pMutex)
{
- OSL_ASSERT(pMutex);
+ SAL_WARN_IF(!pMutex, "sal.osl.mutex", "null pMutex");
+
+ SAL_INFO("sal.osl.mutex", "osl_acquireMutex(" << pMutex << ")");
if ( pMutex != 0 )
{
@@ -104,8 +105,7 @@ sal_Bool SAL_CALL osl_acquireMutex(oslMutexImpl *pMutex)
nRet = pthread_mutex_lock(&(pMutex->mutex));
if ( nRet != 0 )
{
- OSL_TRACE("osl_acquireMutex : mutex lock failed. Errno: %d; %s\n",
- nRet, strerror(nRet));
+ SAL_WARN("sal.osl.mutex", "pthread_mutex_lock failed: " << strerror(nRet));
return sal_False;
}
return sal_True;
@@ -117,25 +117,28 @@ sal_Bool SAL_CALL osl_acquireMutex(oslMutexImpl *pMutex)
sal_Bool SAL_CALL osl_tryToAcquireMutex(oslMutexImpl *pMutex)
{
- OSL_ASSERT(pMutex);
+ sal_Bool result = sal_False;
+
+ SAL_WARN_IF(!pMutex, "sal.osl.mutex", "null pMutex");
if ( pMutex )
{
int nRet = 0;
nRet = pthread_mutex_trylock(&(pMutex->mutex));
- if ( nRet != 0 )
- return sal_False;
-
- return sal_True;
+ if ( nRet == 0 )
+ result = sal_True;
}
- /* not initialized */
- return sal_False;
+ SAL_INFO("sal.osl.mutex", "osl_tryToAcquireMutex(" << pMutex << "): " << (result ? "YES" : "NO"));
+
+ return result;
}
sal_Bool SAL_CALL osl_releaseMutex(oslMutexImpl *pMutex)
{
- OSL_ASSERT(pMutex);
+ SAL_WARN_IF(!pMutex, "sal.osl.mutex", "null pMutex");
+
+ SAL_INFO("sal.osl.mutex", "osl_releaseMutex(" << pMutex << ")");
if ( pMutex )
{
@@ -143,8 +146,7 @@ sal_Bool SAL_CALL osl_releaseMutex(oslMutexImpl *pMutex)
nRet = pthread_mutex_unlock(&(pMutex->mutex));
if ( nRet != 0 )
{
- OSL_TRACE("osl_releaseMutex : mutex unlock failed. Errno: %d; %s\n",
- nRet, strerror(nRet));
+ SAL_WARN("sal.osl.mutex", "pthread_mutex_unlock failed: " << strerror(nRet));
return sal_False;
}
More information about the Libreoffice-commits
mailing list