
#include <libclientserver.h>

ScopedLock::ScopedLock(Mutex *m) :
    m_mutex(m)
{
    m_mutex->Lock();
    m_locked = true;
}

ScopedLock::ScopedLock(Mutex *m, std::function<void()> ErrorHandler) :
    m_mutex(m)
{
    if (m->TryLock()) {
        ErrorHandler();
    }
    m_locked = true;
}

ScopedLock::~ScopedLock() {
    if (m_locked)
    {
        m_mutex->Unlock();
        m_locked = false;
    }
}

void ScopedLock::Lock()
{
    if (m_locked)
        abort();
    m_mutex->Lock();
    m_locked = true;
}

void ScopedLock::Unlock()
{
    if (m_locked == false)
        abort();
    m_mutex->Unlock();
    m_locked = false;
}




#include <libclientserver.h>

ScopedLock::ScopedLock(Mutex *m) {
    m_mutex = m;
    m_mutex->Lock();
    m_locked = true;
}

ScopedLock::ScopedLock(Mutex *m, std::function<void()> ErrorHandler) :
    m_mutex(m)
{
    if (m->TryLock()) {
        ErrorHandler();
    }
    m_locked = true;
}

ScopedLock::~ScopedLock() {
    if (m_locked)
    {
        m_mutex->Unlock();
        m_locked = false;
    }
}

void ScopedLock::Lock()
{
    if (m_locked)
        abort();
    m_mutex->Lock();
    m_locked = true;
}

void ScopedLock::Unlock()
{
    if (m_locked == false)
        abort();
    m_mutex->Unlock();
    m_locked = false;
}



--- 
+++ 
@@ -1,8 +1,9 @@
 
 #include <libclientserver.h>
 
-ScopedLock::ScopedLock(Mutex *m) {
-    m_mutex = m;
+ScopedLock::ScopedLock(Mutex *m) :
+    m_mutex(m)
+{
     m_mutex->Lock();
     m_locked = true;
 }
Move m_mutex to init list
