You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-15 13:51:40 +00:00
Fix memory leak in set_custom_mouse_cursor
This commit is contained in:
@@ -2198,7 +2198,7 @@ void OS_X11::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c
|
||||
cursor_image->yhot = p_hotspot.y;
|
||||
|
||||
// allocate memory to contain the whole file
|
||||
cursor_image->pixels = (XcursorPixel *)malloc(size);
|
||||
cursor_image->pixels = (XcursorPixel *)memalloc(size);
|
||||
|
||||
for (XcursorPixel index = 0; index < image_size; index++) {
|
||||
int row_index = floor(index / texture_size.width) + atlas_rect.pos.y;
|
||||
@@ -2220,6 +2220,9 @@ void OS_X11::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c
|
||||
if (p_shape == CURSOR_ARROW) {
|
||||
XDefineCursor(x11_display, x11_window, cursors[p_shape]);
|
||||
}
|
||||
|
||||
memfree(cursor_image->pixels);
|
||||
XcursorImageDestroy(cursor_image);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user