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:
@@ -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;
|
||||
|
Reference in New Issue
Block a user