mouse: Ensure that the dummy default cursor is removed from the cursor list
In the case where a dummy cursor is created as the default cursor, make sure it is removed from the cursor list when freeing the default cursor.main
parent
e58c2731fe
commit
d60ebb06d1
|
@ -233,12 +233,26 @@ void SDL_SetDefaultCursor(SDL_Cursor *cursor)
|
|||
|
||||
if (mouse->def_cursor) {
|
||||
SDL_Cursor *default_cursor = mouse->def_cursor;
|
||||
SDL_Cursor *prev, *curr;
|
||||
|
||||
if (mouse->cur_cursor == mouse->def_cursor) {
|
||||
mouse->cur_cursor = NULL;
|
||||
}
|
||||
mouse->def_cursor = NULL;
|
||||
|
||||
for (prev = NULL, curr = mouse->cursors; curr;
|
||||
prev = curr, curr = curr->next) {
|
||||
if (curr == default_cursor) {
|
||||
if (prev) {
|
||||
prev->next = curr->next;
|
||||
} else {
|
||||
mouse->cursors = curr->next;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (mouse->FreeCursor && default_cursor->driverdata) {
|
||||
mouse->FreeCursor(default_cursor);
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue