summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-06-08 12:32:34 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-06-09 06:48:35 +0000
commit6ab52cbb0ef1d2d08938d9355300155dbbb691fe (patch)
treea16ad227e5fb0cfc4b3a952ed0ec304d2f8de92c /tools
parent10aaf339862776c9906e195d34c238187f0ea6ac (diff)
reduce "no DbgTestSolarMutex function set" warning
Change-Id: I68c67e77a2759c8542dd4a44a78a9fcf8aa7dcc0 Reviewed-on: https://gerrit.libreoffice.org/26056 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/source/debug/debug.cxx34
1 files changed, 15 insertions, 19 deletions
diff --git a/tools/source/debug/debug.cxx b/tools/source/debug/debug.cxx
index edb4ffe8b7dc..dafd60a74d59 100644
--- a/tools/source/debug/debug.cxx
+++ b/tools/source/debug/debug.cxx
@@ -47,35 +47,31 @@
struct DebugData
{
DbgTestSolarMutexProc pDbgTestSolarMutex;
+ bool bTestSolarMutexWasSet;
DebugData()
- :pDbgTestSolarMutex( nullptr )
+ :pDbgTestSolarMutex( nullptr ), bTestSolarMutexWasSet(false)
{
}
};
static DebugData aDebugData;
-void* DbgFunc( sal_uInt16 nAction, void* pParam )
+void DbgSetTestSolarMutex( DbgTestSolarMutexProc pParam )
{
- DebugData* pDebugData = &aDebugData;
-
- switch ( nAction )
- {
- case DBG_FUNC_SETTESTSOLARMUTEX:
- pDebugData->pDbgTestSolarMutex = reinterpret_cast<DbgTestSolarMutexProc>(reinterpret_cast<sal_uIntPtr>(pParam));
- break;
-
- case DBG_FUNC_TESTSOLARMUTEX:
- SAL_WARN_IF(
- pDebugData->pDbgTestSolarMutex == nullptr, "tools.debug",
- "no DbgTestSolarMutex function set");
- if ( pDebugData->pDbgTestSolarMutex )
- pDebugData->pDbgTestSolarMutex();
- break;
- }
+ aDebugData.pDbgTestSolarMutex = pParam;
+ if (pParam)
+ aDebugData.bTestSolarMutexWasSet = true;
+}
- return nullptr;
+void DbgTestSolarMutex()
+{
+ // don't warn if it was set at least once, because then we're probably just post-DeInitVCL()
+ SAL_WARN_IF(
+ !aDebugData.bTestSolarMutexWasSet && aDebugData.pDbgTestSolarMutex == nullptr, "tools.debug",
+ "no DbgTestSolarMutex function set");
+ if ( aDebugData.pDbgTestSolarMutex )
+ aDebugData.pDbgTestSolarMutex();
}
#endif