fix "pure virtual method called" on quit
This commit is contained in:
@@ -34,7 +34,7 @@ void MemoryCardDriverThreaded::StartThread()
|
||||
m_threadMemoryCardMount.Create( MountThread_Start, this );
|
||||
}
|
||||
|
||||
MemoryCardDriverThreaded::~MemoryCardDriverThreaded()
|
||||
void MemoryCardDriverThreaded::StopThread()
|
||||
{
|
||||
m_bShutdownNextUpdate = true;
|
||||
LOG->Trace( "Shutting down Mount thread..." );
|
||||
@@ -42,6 +42,15 @@ MemoryCardDriverThreaded::~MemoryCardDriverThreaded()
|
||||
LOG->Trace( "Mount thread shut down." );
|
||||
}
|
||||
|
||||
MemoryCardDriverThreaded::~MemoryCardDriverThreaded()
|
||||
{
|
||||
/* Must call StopThread from the derived destructor. Otherwise, we can
|
||||
* call MountThreadDoOneUpdate from the thread after the derived dtor,
|
||||
* which means that function is now virtual, and we'll crash with "pure
|
||||
* virtual method called". */
|
||||
ASSERT( !m_threadMemoryCardMount.IsCreated() );
|
||||
}
|
||||
|
||||
void MemoryCardDriverThreaded::PauseMountingThread()
|
||||
{
|
||||
m_mutexPause.Lock();
|
||||
|
||||
@@ -42,6 +42,7 @@ private:
|
||||
|
||||
protected:
|
||||
void StartThread(); // call this in the derived constructor to start the mounting thread
|
||||
void StopThread(); // call this in the derived desstructor to stop the mounting thread
|
||||
virtual void MountThreadDoOneUpdate() = 0; // this will get called as fast as possible
|
||||
virtual void Mount( UsbStorageDevice* pDevice, CString sMountPoint ) = 0;
|
||||
|
||||
|
||||
@@ -136,6 +136,11 @@ MemoryCardDriverThreaded_Linux::MemoryCardDriverThreaded_Linux()
|
||||
this->StartThread();
|
||||
}
|
||||
|
||||
MemoryCardDriverThreaded_Linux::~MemoryCardDriverThreaded_Linux()
|
||||
{
|
||||
this->StopThread();
|
||||
}
|
||||
|
||||
void MemoryCardDriverThreaded_Linux::ResetUsbStorage()
|
||||
{
|
||||
//
|
||||
|
||||
@@ -7,6 +7,7 @@ class MemoryCardDriverThreaded_Linux : public MemoryCardDriverThreaded
|
||||
{
|
||||
public:
|
||||
MemoryCardDriverThreaded_Linux();
|
||||
virtual ~MemoryCardDriverThreaded_Linux();
|
||||
|
||||
virtual void Unmount( UsbStorageDevice* pDevice, CString sMountPoint );
|
||||
virtual void Flush( UsbStorageDevice* pDevice );
|
||||
|
||||
@@ -18,6 +18,11 @@ MemoryCardDriverThreaded_Windows::MemoryCardDriverThreaded_Windows()
|
||||
StartThread();
|
||||
}
|
||||
|
||||
MemoryCardDriverThreaded_Windows::~MemoryCardDriverThreaded_Windows()
|
||||
{
|
||||
StopThread();
|
||||
}
|
||||
|
||||
typedef const CString& CCStringRef;
|
||||
|
||||
static bool TestReady( CCStringRef sDrive )
|
||||
|
||||
@@ -8,6 +8,7 @@ class MemoryCardDriverThreaded_Windows : public MemoryCardDriverThreaded
|
||||
{
|
||||
public:
|
||||
MemoryCardDriverThreaded_Windows();
|
||||
virtual ~MemoryCardDriverThreaded_Windows();
|
||||
|
||||
virtual void Unmount( UsbStorageDevice* pDevice, CString sMountPoint );
|
||||
virtual void Flush( UsbStorageDevice* pDevice );
|
||||
|
||||
Reference in New Issue
Block a user