Ver Fonte

mouse: Free the default cursor when destroyed

The default cursor was being leaked on destruction as it is not in the cursor list, and subsequently SDL_DestroyCursor() wouldn't call the free function for it.
Frank Praznik há 2 anos atrás
pai
commit
e58c2731fe
1 ficheiros alterados com 5 adições e 1 exclusões
  1. 5 1
      src/events/SDL_mouse.c

+ 5 - 1
src/events/SDL_mouse.c

@@ -239,7 +239,11 @@ void SDL_SetDefaultCursor(SDL_Cursor *cursor)
         }
         }
         mouse->def_cursor = NULL;
         mouse->def_cursor = NULL;
 
 
-        SDL_DestroyCursor(default_cursor);
+        if (mouse->FreeCursor && default_cursor->driverdata) {
+            mouse->FreeCursor(default_cursor);
+        } else {
+            SDL_free(default_cursor);
+        }
     }
     }
 
 
     mouse->def_cursor = cursor;
     mouse->def_cursor = cursor;