The function:
void WIN_FreeWMCursor(_THIS, WMcursor cursor)
{
#ifndef USE_STATIC_CURSOR
if ( cursor->curs != NULL )
DestroyCursor(cursor->curs);
if ( cursor->ands != NULL )
free(cursor->ands);
if ( cursor->xors != NULL )
free(cursor->xors);
#endif / !USE_STATIC_CURSOR */
free(cursor);
}
causes a resource leak when applied to an active cursor. Also DestroyCursor
returns NULL which indicates an error.
This can be be fixed by adding the following lines:
if (cursor->curs == GetCursor ())
SetCursor (NULL);
to check whether the cursor is active.
The resulting code reads:
void WIN_FreeWMCursor(_THIS, WMcursor cursor)
{
#ifndef USE_STATIC_CURSOR
if (cursor->curs == GetCursor ())
SetCursor (NULL);
if ( cursor->curs != NULL )
DestroyCursor(cursor->curs);
if ( cursor->ands != NULL )
free(cursor->ands);
if ( cursor->xors != NULL )
free(cursor->xors);
#endif / !USE_STATIC_CURSOR */
free(cursor);
}
Huib-Jan