mirror of
https://github.com/PCSX2/pcsx2.git
synced 2026-01-31 01:15:24 +01:00
3rdparty:wxwidgets: Preserve Win32 last error in wxTlsKey::Get()
This is commit e093a3b1b402c067254558d24ef2d7f39f552251 from the wx3.0 stable branch. The correct error code and message is now output when an error takes place. Previously it would report an error code of 0 and inform us that "The operation completed successfully".
This commit is contained in:
9
3rdparty/wxwidgets3.0/include/wx/msw/tls.h
vendored
9
3rdparty/wxwidgets3.0/include/wx/msw/tls.h
vendored
@@ -34,7 +34,14 @@ public:
|
||||
// get the key value, there is no error return
|
||||
void *Get() const
|
||||
{
|
||||
return ::TlsGetValue(m_slot);
|
||||
// Exceptionally, TlsGetValue() calls SetLastError() even on success
|
||||
// which means it overwrites the previous value. This is undesirable
|
||||
// here, so explicitly preserve the last error here.
|
||||
const DWORD dwLastError = ::GetLastError();
|
||||
void* const value = ::TlsGetValue(m_slot);
|
||||
if (dwLastError)
|
||||
::SetLastError(dwLastError);
|
||||
return value;
|
||||
}
|
||||
|
||||
// change the key value, return true if ok
|
||||
|
||||
Reference in New Issue
Block a user