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