corrected disposal for b/w cursors and creation and disposal of colour cursors
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19154 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -63,9 +63,11 @@ wxCursorRefData::~wxCursorRefData()
|
|||||||
else if ( m_disposeHandle )
|
else if ( m_disposeHandle )
|
||||||
{
|
{
|
||||||
::DisposeHandle( (Handle ) m_hCursor ) ;
|
::DisposeHandle( (Handle ) m_hCursor ) ;
|
||||||
} else if ( m_releaseHandle )
|
}
|
||||||
|
else if ( m_releaseHandle )
|
||||||
{
|
{
|
||||||
::ReleaseResource( (Handle ) m_hCursor ) ;
|
// we don't release the resource since it may already
|
||||||
|
// be in use again
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,16 +168,30 @@ wxCursor::wxCursor(const wxString& cursor_file, long flags, int hotSpotX, int ho
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxStAppResource resload ;
|
wxStAppResource resload ;
|
||||||
M_CURSORDATA->m_hCursor = ::GetNamedResource( 'crsr' , theName ) ;
|
Handle resHandle = ::GetNamedResource( 'crsr' , theName ) ;
|
||||||
if ( M_CURSORDATA->m_hCursor )
|
if ( resHandle )
|
||||||
{
|
{
|
||||||
M_CURSORDATA->m_isColorCursor = true ;
|
short theId = -1 ;
|
||||||
|
OSType theType ;
|
||||||
|
GetResInfo( resHandle , &theId , &theType , theName ) ;
|
||||||
|
ReleaseResource( resHandle ) ;
|
||||||
|
M_CURSORDATA->m_hCursor = GetCCursor( theId ) ;
|
||||||
|
if ( M_CURSORDATA->m_hCursor )
|
||||||
|
M_CURSORDATA->m_isColorCursor = true ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
M_CURSORDATA->m_hCursor = ::GetNamedResource( 'CURS' , theName ) ;
|
Handle resHandle = ::GetNamedResource( 'CURS' , theName ) ;
|
||||||
if ( M_CURSORDATA->m_hCursor )
|
if ( resHandle )
|
||||||
M_CURSORDATA->m_releaseHandle = true ;
|
{
|
||||||
|
short theId = -1 ;
|
||||||
|
OSType theType ;
|
||||||
|
GetResInfo( resHandle , &theId , &theType , theName ) ;
|
||||||
|
ReleaseResource( resHandle ) ;
|
||||||
|
M_CURSORDATA->m_hCursor = GetCursor( theId ) ;
|
||||||
|
if ( M_CURSORDATA->m_hCursor )
|
||||||
|
M_CURSORDATA->m_releaseHandle = true ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -63,9 +63,11 @@ wxCursorRefData::~wxCursorRefData()
|
|||||||
else if ( m_disposeHandle )
|
else if ( m_disposeHandle )
|
||||||
{
|
{
|
||||||
::DisposeHandle( (Handle ) m_hCursor ) ;
|
::DisposeHandle( (Handle ) m_hCursor ) ;
|
||||||
} else if ( m_releaseHandle )
|
}
|
||||||
|
else if ( m_releaseHandle )
|
||||||
{
|
{
|
||||||
::ReleaseResource( (Handle ) m_hCursor ) ;
|
// we don't release the resource since it may already
|
||||||
|
// be in use again
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,16 +168,30 @@ wxCursor::wxCursor(const wxString& cursor_file, long flags, int hotSpotX, int ho
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxStAppResource resload ;
|
wxStAppResource resload ;
|
||||||
M_CURSORDATA->m_hCursor = ::GetNamedResource( 'crsr' , theName ) ;
|
Handle resHandle = ::GetNamedResource( 'crsr' , theName ) ;
|
||||||
if ( M_CURSORDATA->m_hCursor )
|
if ( resHandle )
|
||||||
{
|
{
|
||||||
M_CURSORDATA->m_isColorCursor = true ;
|
short theId = -1 ;
|
||||||
|
OSType theType ;
|
||||||
|
GetResInfo( resHandle , &theId , &theType , theName ) ;
|
||||||
|
ReleaseResource( resHandle ) ;
|
||||||
|
M_CURSORDATA->m_hCursor = GetCCursor( theId ) ;
|
||||||
|
if ( M_CURSORDATA->m_hCursor )
|
||||||
|
M_CURSORDATA->m_isColorCursor = true ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
M_CURSORDATA->m_hCursor = ::GetNamedResource( 'CURS' , theName ) ;
|
Handle resHandle = ::GetNamedResource( 'CURS' , theName ) ;
|
||||||
if ( M_CURSORDATA->m_hCursor )
|
if ( resHandle )
|
||||||
M_CURSORDATA->m_releaseHandle = true ;
|
{
|
||||||
|
short theId = -1 ;
|
||||||
|
OSType theType ;
|
||||||
|
GetResInfo( resHandle , &theId , &theType , theName ) ;
|
||||||
|
ReleaseResource( resHandle ) ;
|
||||||
|
M_CURSORDATA->m_hCursor = GetCursor( theId ) ;
|
||||||
|
if ( M_CURSORDATA->m_hCursor )
|
||||||
|
M_CURSORDATA->m_releaseHandle = true ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user