Skip to content

Commit 6605de4

Browse files
committed
Fixed server crash when using db* functions during onDebugMessage event
1 parent 85f71dc commit 6605de4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

MTA10_Server/mods/deathmatch/logic/CDatabaseJobQueue.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,9 @@ void CDatabaseJobQueueImpl::UpdateDebugData ( void )
327327
CTickCount age = timeNow - pJobData->result.timeReady;
328328
if ( age.ToLongLong () > 1000 * 60 * 5 )
329329
{
330+
shared.m_Mutex.Unlock ();
330331
g_pGame->GetScriptDebugging()->LogWarning( pJobData->m_LuaDebugInfo, "Database result uncollected after 5 minutes. [Query: %s]", *pJobData->command.strData );
332+
shared.m_Mutex.Lock ();
331333
pJobData->result.bLoggedWarning = true;
332334
break;
333335
}
@@ -403,7 +405,9 @@ bool CDatabaseJobQueueImpl::PollCommand ( CDbJobData* pJobData, uint uiTimeout )
403405
// Issue warning if it's taking a long time
404406
if ( uiTotalWaitTime > uiWaitTimeWarnThresh )
405407
{
408+
shared.m_Mutex.Unlock ();
406409
g_pGame->GetScriptDebugging()->LogWarning( pJobData->m_LuaDebugInfo, "dbPoll is waiting a long time (%d seconds so far). [Query: %s]", uiTotalWaitTime / 1000, *pJobData->command.strData );
410+
shared.m_Mutex.Lock ();
407411
uiWaitTimeWarnThresh += TICKS_FROM_SECONDS( 60 );
408412
}
409413
}

0 commit comments

Comments
 (0)