diff --git a/common/include/Utilities/Dependencies.h b/common/include/Utilities/Dependencies.h index 1ad38db121..31bc649149 100644 --- a/common/include/Utilities/Dependencies.h +++ b/common/include/Utilities/Dependencies.h @@ -246,5 +246,4 @@ extern wxString fromAscii( const char* src ); #include "Utilities/Assertions.h" #include "Utilities/Exceptions.h" -#include "Utilities/ScopedPtr.h" #include "Utilities/ScopedAlloc.h" diff --git a/common/include/Utilities/Threading.h b/common/include/Utilities/Threading.h index e21522ae2e..6f2cfcb71f 100644 --- a/common/include/Utilities/Threading.h +++ b/common/include/Utilities/Threading.h @@ -24,7 +24,6 @@ #endif #include "Pcsx2Defs.h" -#include "ScopedPtr.h" #include "TraceLog.h" #undef Yield // release the burden of windows.h global namespace spam. diff --git a/common/include/Utilities/pxStreams.h b/common/include/Utilities/pxStreams.h index 4d99b7eb56..b810c93fc4 100644 --- a/common/include/Utilities/pxStreams.h +++ b/common/include/Utilities/pxStreams.h @@ -16,6 +16,7 @@ #pragma once #include "wx/filefn.h" +#include // -------------------------------------------------------------------------------------- // pxStreamBase @@ -55,19 +56,19 @@ class pxOutputStream : public pxStreamBase DeclareNoncopyableObject(pxOutputStream); protected: - ScopedPtr m_stream_out; + std::unique_ptr m_stream_out; public: - pxOutputStream(const wxString& filename, ScopedPtr& output); + pxOutputStream(const wxString& filename, std::unique_ptr& output); pxOutputStream(const wxString& filename, wxOutputStream* output); virtual ~pxOutputStream() throw() {} virtual void Write( const void* data, size_t size ); - void SetStream( const wxString& filename, ScopedPtr& stream ); + void SetStream( const wxString& filename, std::unique_ptr& stream ); void SetStream( const wxString& filename, wxOutputStream* stream ); - void Close() { m_stream_out.Delete(); } + void Close() { m_stream_out = nullptr; } virtual wxStreamBase* GetWxStreamBase() const; @@ -89,19 +90,19 @@ class pxInputStream : public pxStreamBase DeclareNoncopyableObject(pxInputStream); protected: - ScopedPtr m_stream_in; + std::unique_ptr m_stream_in; public: - pxInputStream(const wxString& filename, ScopedPtr& input); + pxInputStream(const wxString& filename, std::unique_ptr& input); pxInputStream(const wxString& filename, wxInputStream* input); virtual ~pxInputStream() throw() {} virtual void Read( void* dest, size_t size ); - void SetStream( const wxString& filename, ScopedPtr& stream ); + void SetStream( const wxString& filename, std::unique_ptr& stream ); void SetStream( const wxString& filename, wxInputStream* stream ); - void Close() { m_stream_in.Delete(); } + void Close() { m_stream_in = nullptr; } virtual wxStreamBase* GetWxStreamBase() const; diff --git a/common/include/Utilities/wxGuiTools.h b/common/include/Utilities/wxGuiTools.h index e182f56776..39aa1589d1 100644 --- a/common/include/Utilities/wxGuiTools.h +++ b/common/include/Utilities/wxGuiTools.h @@ -28,7 +28,7 @@ #if wxUSE_GUI #include "Dependencies.h" -#include "ScopedPtr.h" +#include #include #include @@ -741,7 +741,7 @@ public: class MoreStockCursors { protected: - ScopedPtr m_arrowWait; + std::unique_ptr m_arrowWait; public: MoreStockCursors() { } diff --git a/common/src/Utilities/pxStreams.cpp b/common/src/Utilities/pxStreams.cpp index cb949072b3..ee9ac3ecf0 100644 --- a/common/src/Utilities/pxStreams.cpp +++ b/common/src/Utilities/pxStreams.cpp @@ -47,9 +47,9 @@ wxFileOffset pxStreamBase::Length() const // Interface for reading data from a gzip stream. // -pxInputStream::pxInputStream(const wxString& filename, ScopedPtr& input) +pxInputStream::pxInputStream(const wxString& filename, std::unique_ptr& input) : pxStreamBase( filename ) - , m_stream_in( input.DetachPtr() ) + , m_stream_in( std::move(input) ) { } @@ -59,7 +59,7 @@ pxInputStream::pxInputStream(const wxString& filename, wxInputStream* input) { } -wxStreamBase* pxInputStream::GetWxStreamBase() const { return m_stream_in.GetPtr(); } +wxStreamBase* pxInputStream::GetWxStreamBase() const { return m_stream_in.get(); } wxFileOffset pxInputStream::Tell() const { @@ -71,16 +71,16 @@ wxFileOffset pxInputStream::Seek( wxFileOffset ofs, wxSeekMode mode ) return m_stream_in->SeekI(ofs, mode); } -void pxInputStream::SetStream( const wxString& filename, ScopedPtr& stream ) +void pxInputStream::SetStream( const wxString& filename, std::unique_ptr& stream ) { m_filename = filename; - m_stream_in = stream.DetachPtr(); + m_stream_in = std::move(stream); } void pxInputStream::SetStream( const wxString& filename, wxInputStream* stream ) { m_filename = filename; - m_stream_in = stream; + m_stream_in = std::unique_ptr(stream); } void pxInputStream::Read( void* dest, size_t size ) @@ -108,9 +108,9 @@ void pxInputStream::Read( void* dest, size_t size ) // -------------------------------------------------------------------------------------- // pxOutputStream // -------------------------------------------------------------------------------------- -pxOutputStream::pxOutputStream(const wxString& filename, ScopedPtr& output) +pxOutputStream::pxOutputStream(const wxString& filename, std::unique_ptr& output) : pxStreamBase( filename ) - , m_stream_out( output.DetachPtr() ) + , m_stream_out( std::move(output) ) { } @@ -121,7 +121,7 @@ pxOutputStream::pxOutputStream(const wxString& filename, wxOutputStream* output) { } -wxStreamBase* pxOutputStream::GetWxStreamBase() const { return m_stream_out.GetPtr(); } +wxStreamBase* pxOutputStream::GetWxStreamBase() const { return m_stream_out.get(); } wxFileOffset pxOutputStream::Tell() const { @@ -133,16 +133,16 @@ wxFileOffset pxOutputStream::Seek( wxFileOffset ofs, wxSeekMode mode ) return m_stream_out->SeekO( ofs, mode ); } -void pxOutputStream::SetStream( const wxString& filename, ScopedPtr& stream ) +void pxOutputStream::SetStream( const wxString& filename, std::unique_ptr& stream ) { m_filename = filename; - m_stream_out = stream.DetachPtr(); + m_stream_out = std::move(stream); } void pxOutputStream::SetStream( const wxString& filename, wxOutputStream* stream ) { m_filename = filename; - m_stream_out = stream; + m_stream_out = std::unique_ptr(stream); } diff --git a/common/src/Utilities/wxAppWithHelpers.cpp b/common/src/Utilities/wxAppWithHelpers.cpp index c231a6a2db..e8f3feb273 100644 --- a/common/src/Utilities/wxAppWithHelpers.cpp +++ b/common/src/Utilities/wxAppWithHelpers.cpp @@ -387,7 +387,7 @@ bool wxAppWithHelpers::ProcessEvent( wxEvent& evt ) bool wxAppWithHelpers::ProcessEvent( wxEvent* evt ) { AffinityAssert_AllowFrom_MainUI(); - ScopedPtr deleteMe( evt ); + std::unique_ptr deleteMe( evt ); return _parent::ProcessEvent( *deleteMe ); } @@ -409,7 +409,7 @@ bool wxAppWithHelpers::ProcessEvent( pxActionEvent* evt ) { if( wxThread::IsMain() ) { - ScopedPtr deleteMe( evt ); + std::unique_ptr deleteMe( evt ); return _parent::ProcessEvent( *deleteMe ); } else @@ -513,7 +513,7 @@ void wxAppWithHelpers::IdleEventDispatcher( const wxChar* action ) while( node = m_IdleEventQueue.begin(), node != m_IdleEventQueue.end() ) { - ScopedPtr deleteMe(*node); + std::unique_ptr deleteMe(*node); m_IdleEventQueue.erase( node ); lock.Release(); @@ -524,8 +524,8 @@ void wxAppWithHelpers::IdleEventDispatcher( const wxChar* action ) // thread to crash. So we disallow deletions when those waits are in action, and continue // to postpone the deletion of the thread until such time that it is safe. - pxThreadLog.Write( ((pxThread*)((wxCommandEvent*)deleteMe.GetPtr())->GetClientData())->GetName(), L"Deletion postponed due to mutex or semaphore dependency." ); - postponed.push_back(deleteMe.DetachPtr()); + pxThreadLog.Write( ((pxThread*)((wxCommandEvent*)deleteMe.get())->GetClientData())->GetName(), L"Deletion postponed due to mutex or semaphore dependency." ); + postponed.push_back(deleteMe.release()); } else { @@ -680,7 +680,7 @@ wxAppTraits* wxAppWithHelpers::CreateTraits() // (thus we have a fairly automatic threaded exception system!) void wxAppWithHelpers::OnDeleteThread( wxCommandEvent& evt ) { - ScopedPtr thr( (pxThread*)evt.GetClientData() ); + std::unique_ptr thr( (pxThread*)evt.GetClientData() ); if( !thr ) { pxThreadLog.Write( L"null", L"OnDeleteThread: NULL thread object received (and ignored)." ); diff --git a/common/src/Utilities/wxGuiTools.cpp b/common/src/Utilities/wxGuiTools.cpp index a142629ddf..073f4672f2 100644 --- a/common/src/Utilities/wxGuiTools.cpp +++ b/common/src/Utilities/wxGuiTools.cpp @@ -562,7 +562,7 @@ void ScopedBusyCursor::SetManualBusyCursor( BusyCursorType busytype ) const wxCursor& MoreStockCursors::GetArrowWait() { if( !m_arrowWait ) - m_arrowWait = new wxCursor( wxCURSOR_ARROWWAIT ); + m_arrowWait = std::unique_ptr(new wxCursor( wxCURSOR_ARROWWAIT )); return *m_arrowWait; }