Use GlobalPtrLock instead of manual Global{Lock,Unlock}() calls

Also add GlobalPtrLock::GetSize() and use it instead of calling
GetSizeFromBuffer() as it's more direct and doesn't require the use of
::GlobalHandle().
This commit is contained in:
Vadim Zeitlin
2020-08-22 19:30:03 +02:00
parent aadfaada7a
commit 0d7be7c189
2 changed files with 16 additions and 16 deletions

View File

@@ -773,6 +773,15 @@ public:
void *Get() const { return m_ptr; }
operator void *() const { return m_ptr; }
size_t GetSize() const
{
const size_t size = ::GlobalSize(m_hGlobal);
if ( !size )
wxLogLastError(wxT("GlobalSize"));
return size;
}
private:
HGLOBAL m_hGlobal;
void *m_ptr;