Skip to content
Snippets Groups Projects
Commit 918100d5 authored by jpbl's avatar jpbl
Browse files

fixed the lock problem

parent 7c9839ee
No related branches found
No related tags found
No related merge requests found
......@@ -106,12 +106,14 @@ PhoneLine::sendKey(Qt::Key c)
break;
default:
if(!mCall) {
mSession.playDtmf(c);
mBuffer += QString(c).toStdString();
}
else {
mCall->sendDtmf(c);
if (QChar(c).isDigit()) {
if(!mCall) {
mSession.playDtmf(c);
mBuffer += QString(c).toStdString();
}
else {
mCall->sendDtmf(c);
}
}
}
}
......
......@@ -41,13 +41,16 @@ PhoneLineManagerImpl::getNextAvailableLine()
PhoneLine *selectedLine = NULL;
QMutexLocker guard(&mPhoneLinesMutex);
QMutexLocker guard2(&mCurrentLineMutex);
mCurrentLineMutex.lock();
PhoneLine *current = mCurrentLine;
mCurrentLineMutex.unlock();
unsigned int i = 0;
while(i < mPhoneLines.size() && !selectedLine) {
mPhoneLines[i]->lock();
if(mPhoneLines[i]->isAvailable() &&
mPhoneLines[i] != mCurrentLine) {
mPhoneLines[i] != current) {
selectedLine = mPhoneLines[i];
}
else {
......@@ -75,11 +78,9 @@ PhoneLineManagerImpl::selectNextAvailableLine()
mCurrentLine = selectedLine;
// select current line.
{
PhoneLineLocker guard(mCurrentLine);
mCurrentLine->select();
}
// We don't need to lock it, since it is
// done at the top.
selectedLine->select();
}
return selectedLine;
......
......@@ -6,7 +6,7 @@ TEMPLATE = app
TARGET +=
DEPENDPATH += .
INCLUDEPATH += .
#CONFIG += debug
CONFIG += debug
# Input
HEADERS += Account.hpp \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment