Index: ext/libicpf/src/dmutex.cpp
===================================================================
diff -u -r9960df129907ea11b4936b4c2e414d0577cd5f27 -r0ec0dc6be33bf80d16d27555d107509810a93462
--- ext/libicpf/src/dmutex.cpp	(.../dmutex.cpp)	(revision 9960df129907ea11b4936b4c2e414d0577cd5f27)
+++ ext/libicpf/src/dmutex.cpp	(.../dmutex.cpp)	(revision 0ec0dc6be33bf80d16d27555d107509810a93462)
@@ -1,3 +1,26 @@
+/***************************************************************************
+ *   Copyright (C) 2004-2006 by J�zef Starosczyk                           *
+ *   ixen@draknet.sytes.net                                                *
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU Library General Public License as       *
+ *   published by the Free Software Foundation; either version 2 of the    *
+ *   License, or (at your option) any later version.                       *
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU Library General Public     *
+ *   License along with this program; if not, write to the                 *
+ *   Free Software Foundation, Inc.,                                       *
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ ***************************************************************************/
+/** \file dmutex.cpp
+ *  \brief Contains mutex class for thread safe access with debugging capabilities (implementation).
+ *  \see The mutex class.
+ */
 #include "dmutex.h"
 #include <assert.h>
 #include <stdio.h>
@@ -9,7 +32,10 @@
 ///////////////////////////////////////////////////////////////
 // debuggable mutex
 
-/// Static dump context
+/** \brief Static dump context.
+ *
+ *  Must be initialized before using this class.
+ */
 dumpctx* d_mutex::m_pContext=NULL;
 
 /** Constructs an unnamed mutex with a given dump context which will receive
@@ -65,8 +91,11 @@
 	char_t sz[512];
 	sprintf(sz, "%s: Lock (lock count after operation: %lu) in (%s-%lu: %s)", m_pszName, m_ulLockCount, pszFile, ulLine, pszFunction);
 
-	m_pContext->open(sz);
-	m_pContext->close();
+	if (m_pContext)
+	{
+		m_pContext->open(sz);
+		m_pContext->close();
+	}
 }
 
 /** Unlocks this mutex. Takes some parameters that should identify the place in code which
@@ -87,8 +116,11 @@
 	char_t sz[512];
 	sprintf(sz, "%s: Unlock (lock count after operation: %lu) in (%s-%lu: %s)", m_pszName, m_ulLockCount, pszFile, ulLine, pszFunction);
 
-	m_pContext->open(sz);
-	m_pContext->close();
+	if (m_pContext)
+	{
+		m_pContext->open(sz);
+		m_pContext->close();
+	}
 
 	((mutex*)this)->unlock();
 }
Index: ext/libicpf/src/dmutex.h
===================================================================
diff -u -r9960df129907ea11b4936b4c2e414d0577cd5f27 -r0ec0dc6be33bf80d16d27555d107509810a93462
--- ext/libicpf/src/dmutex.h	(.../dmutex.h)	(revision 9960df129907ea11b4936b4c2e414d0577cd5f27)
+++ ext/libicpf/src/dmutex.h	(.../dmutex.h)	(revision 0ec0dc6be33bf80d16d27555d107509810a93462)
@@ -41,6 +41,8 @@
  *  This class is very similar to the mutex class, with the difference that it allows logging
  *  of the locking/unlocking allowing easier debugging of the mutexes. Interface is almost
  *  out-of-the-box replaceable with standard mutex class.
+ *  To use this class properly - the icpf::d_mutex::m_pContext static member has to be initialized
+ *  to a pointer to a dumpctx class that will receive notifications.
  */
 class LIBICPF_API d_mutex : public mutex
 {