HostFS: free fds when shutting down vm (#3671)

* HostFS: free fds when shutting down vm

* HostFs: init arrays at given value
This commit is contained in:
GovanifY 2020-09-18 21:34:43 +02:00 committed by GitHub
parent db36dc2326
commit fa894d9d48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -257,6 +257,7 @@ namespace ioman {
IOManDir *dir;
};
constexpr filedesc(): type(FILE_FREE), file(nullptr) {}
operator bool() const { return type != FILE_FREE; }
operator IOManFile*() const { return type == FILE_FILE ? file : NULL; }
operator IOManDir*() const { return type == FILE_DIR ? dir : NULL; }
@ -326,7 +327,10 @@ namespace ioman {
void reset()
{
for (int i = 0; i < maxfds; i++)
fds[i].close();
{
if (fds[i])
fds[i].close();
}
}
bool is_host(const std::string path)

View File

@ -30,6 +30,7 @@
#include "Utilities/PageFaultSource.h"
#include "Utilities/Threading.h"
#include "IopBios.h"
#ifdef __WXMSW__
# include <wx/msw/wrapwin.h>
@ -64,12 +65,14 @@ SysCoreThread::~SysCoreThread()
void SysCoreThread::Cancel( bool isBlocking )
{
m_hasActiveMachine = false;
R3000A::ioman::reset();
_parent::Cancel();
}
bool SysCoreThread::Cancel( const wxTimeSpan& span )
{
m_hasActiveMachine = false;
R3000A::ioman::reset();
return _parent::Cancel( span );
}
@ -123,6 +126,7 @@ void SysCoreThread::ResetQuick()
m_resetVirtualMachine = true;
m_hasActiveMachine = false;
R3000A::ioman::reset();
}
void SysCoreThread::Reset()
@ -291,6 +295,7 @@ void SysCoreThread::OnCleanupInThread()
m_hasActiveMachine = false;
m_resetVirtualMachine = true;
R3000A::ioman::reset();
// FIXME: temporary workaround for deadlock on exit, which actually should be a crash
vu1Thread.WaitVU();
GetCorePlugins().Close();