Skip to content

Fix some surface refcounting issues in display #2997

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src_c/display.c
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,6 @@ pg_get_surface(PyObject *self, PyObject *_null)
if (!new_surface)
return NULL;
pg_SetDefaultWindowSurface(new_surface);
Py_INCREF((PyObject *)new_surface);
return (PyObject *)new_surface;
}
Py_INCREF(old_surface);
Expand Down Expand Up @@ -1312,7 +1311,6 @@ pg_set_mode(PyObject *self, PyObject *arg, PyObject *kwds)
/*no errors; make the window available*/
pg_SetDefaultWindow(win);
pg_SetDefaultWindowSurface(surface);
Py_DECREF(surface);

/* ensure window is always black after a set_mode call */
SDL_FillRect(surf, NULL, SDL_MapRGB(surf->format, 0, 0, 0));
Expand Down Expand Up @@ -1344,7 +1342,6 @@ pg_set_mode(PyObject *self, PyObject *arg, PyObject *kwds)
SDL_PumpEvents();

/*return the window's surface (screen)*/
Py_INCREF(surface);
return (PyObject *)surface;

DESTROY_WINDOW:
Expand Down
Loading