another wxBeginBusyCursor fix
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1761 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -140,9 +140,13 @@ GdkCursor *wxCursor::GetCursor() const
|
|||||||
extern wxCursor *g_globalCursor;
|
extern wxCursor *g_globalCursor;
|
||||||
|
|
||||||
static wxCursor *gs_savedCursor = NULL;
|
static wxCursor *gs_savedCursor = NULL;
|
||||||
|
static int gs_busyCount = 0;
|
||||||
|
|
||||||
void wxEndBusyCursor()
|
void wxEndBusyCursor()
|
||||||
{
|
{
|
||||||
|
if ( --gs_busyCount > 0 )
|
||||||
|
return;
|
||||||
|
|
||||||
wxCHECK_RET( gs_savedCursor && gs_savedCursor->Ok(),
|
wxCHECK_RET( gs_savedCursor && gs_savedCursor->Ok(),
|
||||||
"calling wxEndBusyCursor() without wxBeginBusyCursor()?" );
|
"calling wxEndBusyCursor() without wxBeginBusyCursor()?" );
|
||||||
|
|
||||||
@@ -153,6 +157,9 @@ void wxEndBusyCursor()
|
|||||||
|
|
||||||
void wxBeginBusyCursor( wxCursor *WXUNUSED(cursor) )
|
void wxBeginBusyCursor( wxCursor *WXUNUSED(cursor) )
|
||||||
{
|
{
|
||||||
|
if ( gs_busyCount++ > 0 )
|
||||||
|
return;
|
||||||
|
|
||||||
wxASSERT_MSG( !gs_savedCursor,
|
wxASSERT_MSG( !gs_savedCursor,
|
||||||
"forgot to call wxEndBusyCursor, will leak memory" );
|
"forgot to call wxEndBusyCursor, will leak memory" );
|
||||||
|
|
||||||
@@ -166,7 +173,7 @@ void wxBeginBusyCursor( wxCursor *WXUNUSED(cursor) )
|
|||||||
|
|
||||||
bool wxIsBusy()
|
bool wxIsBusy()
|
||||||
{
|
{
|
||||||
return gs_savedCursor != NULL;
|
return gs_busyCount > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSetCursor( const wxCursor& cursor )
|
void wxSetCursor( const wxCursor& cursor )
|
||||||
|
@@ -140,9 +140,13 @@ GdkCursor *wxCursor::GetCursor() const
|
|||||||
extern wxCursor *g_globalCursor;
|
extern wxCursor *g_globalCursor;
|
||||||
|
|
||||||
static wxCursor *gs_savedCursor = NULL;
|
static wxCursor *gs_savedCursor = NULL;
|
||||||
|
static int gs_busyCount = 0;
|
||||||
|
|
||||||
void wxEndBusyCursor()
|
void wxEndBusyCursor()
|
||||||
{
|
{
|
||||||
|
if ( --gs_busyCount > 0 )
|
||||||
|
return;
|
||||||
|
|
||||||
wxCHECK_RET( gs_savedCursor && gs_savedCursor->Ok(),
|
wxCHECK_RET( gs_savedCursor && gs_savedCursor->Ok(),
|
||||||
"calling wxEndBusyCursor() without wxBeginBusyCursor()?" );
|
"calling wxEndBusyCursor() without wxBeginBusyCursor()?" );
|
||||||
|
|
||||||
@@ -153,6 +157,9 @@ void wxEndBusyCursor()
|
|||||||
|
|
||||||
void wxBeginBusyCursor( wxCursor *WXUNUSED(cursor) )
|
void wxBeginBusyCursor( wxCursor *WXUNUSED(cursor) )
|
||||||
{
|
{
|
||||||
|
if ( gs_busyCount++ > 0 )
|
||||||
|
return;
|
||||||
|
|
||||||
wxASSERT_MSG( !gs_savedCursor,
|
wxASSERT_MSG( !gs_savedCursor,
|
||||||
"forgot to call wxEndBusyCursor, will leak memory" );
|
"forgot to call wxEndBusyCursor, will leak memory" );
|
||||||
|
|
||||||
@@ -166,7 +173,7 @@ void wxBeginBusyCursor( wxCursor *WXUNUSED(cursor) )
|
|||||||
|
|
||||||
bool wxIsBusy()
|
bool wxIsBusy()
|
||||||
{
|
{
|
||||||
return gs_savedCursor != NULL;
|
return gs_busyCount > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSetCursor( const wxCursor& cursor )
|
void wxSetCursor( const wxCursor& cursor )
|
||||||
|
Reference in New Issue
Block a user