pygame-ce icon indicating copy to clipboard operation
pygame-ce copied to clipboard

Fix some surface refcounting issues in display

Open ankith26 opened this issue 1 year ago • 1 comments
trafficstars

In get_surface, a strong reference was being incref-ed before being returned (double incref issue)

In set_mode there was a decref followed by an incref, which is technically wrong (I suppose in practice it doesn't create an issue, but I fixed it anyways)

ankith26 avatar Jul 15 '24 17:07 ankith26

In set_mode there was a decref followed by an incref, which is technically wrong (I suppose in practice it doesn't create an issue, but I fixed it anyways)

What about the return here:

https://github.com/pygame-community/pygame-ce/blob/f5f850ac07a6aab001fb2d687879d4ab434e77cd/src_c/display.c#L1333-L1339

Won't removing the decref cause a leak if it returns NULL?

MyreMylar avatar Jul 25 '24 16:07 MyreMylar