Fix script hanging when you stop a script with open listeners
This commit is contained in:
parent
82716b247b
commit
9b9ab2af75
|
@ -90,9 +90,12 @@ void CScriptInstance::ForceStop()
|
|||
{
|
||||
// Close all files and delete all hooked callbacks
|
||||
CGuard guard(m_CS);
|
||||
if (m_State != STATE_STOPPED)
|
||||
{
|
||||
CleanUp();
|
||||
SetState(STATE_STOPPED);
|
||||
}
|
||||
}
|
||||
|
||||
duk_context* CScriptInstance::DukContext()
|
||||
{
|
||||
|
@ -220,8 +223,7 @@ void CScriptInstance::StartEventLoop()
|
|||
RemoveListener(lpListener);
|
||||
}
|
||||
|
||||
CleanUp();
|
||||
SetState(STATE_STOPPED);
|
||||
ForceStop();
|
||||
}
|
||||
|
||||
CScriptInstance::EVENT_STATUS
|
||||
|
@ -529,8 +531,8 @@ void CScriptInstance::CloseAllFiles()
|
|||
for (size_t i = 0; i < nFiles; i++)
|
||||
{
|
||||
fclose(m_Files[i].fp);
|
||||
m_Files.erase(m_Files.begin() + i);
|
||||
}
|
||||
m_Files.clear();
|
||||
}
|
||||
|
||||
FILE* CScriptInstance::GetFilePointer(int fd)
|
||||
|
|
Loading…
Reference in New Issue