Skip to content

Commit c109516

Browse files
committed
Merge branch 'main' of https://github.com/pygame-community/pygame-ce into window-create-context
2 parents cb9494b + dd03b30 commit c109516

File tree

5 files changed

+16
-9
lines changed

5 files changed

+16
-9
lines changed

buildconfig/download_win_prebuilt.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ def get_urls(x86=True, x64=True):
8282
'7469e9ea44d30a48b0510328cd94b25596e0aa0f',
8383
],
8484
[
85-
'https://github.com/pygame-community/SDL_image/releases/download/2.8.0-pgce/SDL2_image-devel-2.8.0-VCpgce.zip',
86-
'da6b6a18f1c53baa775394e769059404925e98d7'
85+
'https://github.com/pygame-community/SDL_image/releases/download/2.8.2-pgce/SDL2_image-devel-2.8.2-VCpgce.zip',
86+
'983484dd816abf25cdd5bce88ac69dbca1ea713a'
8787
],
8888
[
8989
'https://github.com/libsdl-org/SDL_ttf/releases/download/release-2.20.2/SDL2_ttf-devel-2.20.2-VC.zip',
@@ -201,12 +201,12 @@ def copy(src, dst):
201201
copy(
202202
os.path.join(
203203
temp_dir,
204-
'SDL2_image-devel-2.8.0-VCpgce/SDL2_image-2.8.0'
204+
'SDL2_image-devel-2.8.2-VCpgce/SDL2_image-2.8.2'
205205
),
206206
os.path.join(
207207
move_to_dir,
208208
prebuilt_dir,
209-
'SDL2_image-2.8.0'
209+
'SDL2_image-2.8.2'
210210
)
211211
)
212212
copy(

buildconfig/manylinux-build/docker_base/sdl_libs/build-sdl2-libs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -e -x
44
cd $(dirname `readlink -f "$0"`)
55

66
SDL2="SDL2-2.28.5"
7-
IMG2="SDL2_image-2.8.0"
7+
IMG2="SDL2_image-2.8.2"
88
TTF2="SDL2_ttf-2.20.2"
99
MIX2="SDL2_mixer-2.6.3"
1010

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
12593eb78fcca877a8dfb78cf21a4e6feba7dc87c964de378ac462b36d8e41ecb587222cb41d5f56dd35b838e1b9867b8ae0cf2f4d2a01afaf23ac8c11edc84d SDL2-2.28.5.tar.gz
2-
b58eb45e5d80a4467ca58672dd74ccf99cc84b9546ad5a3b6fca8caa4cd81351e611eef8aa98e5592f21d326358afe120a9b89e747274d7efa5f5e2c39504ff6 SDL2_image-2.8.0.tar.gz
2+
0ff345824f95158dfa72f83f9d4a540601c178cd759334bf849c14a2920b5330d0763413b58c08b3deba8d3a4ccb6ea2a8159f87efe4cbb0e8ea850f63d09454 SDL2_image-2.8.2.tar.gz
33
2e9da045d2fdab97236c3901b3d441834a67a47c8851ddfb817c9db6f23ed9fb355a5ef8d2158d0c9959a83934e8cd1b95db8a69eaddf8f7fcca115f01818740 SDL2_mixer-2.6.3.tar.gz
44
b54e93b100712e3764cd80d4e4b16cd4c2a6853620f675941a4214320b0ee29a583d57ad56cd5fdb5c7a32d7615cbf43bc3fa55337b01623cee7219ebb43667c SDL2_ttf-2.20.2.tar.gz

src_c/surface.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2145,6 +2145,7 @@ surf_fblits(pgSurfaceObject *self, PyObject *const *args, Py_ssize_t nargs)
21452145
PyObject *blit_sequence, *item, *src_surf, *blit_pos;
21462146
int blend_flags = 0; /* Default flag is 0, opaque */
21472147
int error = 0;
2148+
int is_generator = 0;
21482149

21492150
if (nargs == 0 || nargs > 2) {
21502151
error = FBLITS_ERR_INCORRECT_ARGS_NUM;
@@ -2216,11 +2217,11 @@ surf_fblits(pgSurfaceObject *self, PyObject *const *args, Py_ssize_t nargs)
22162217
}
22172218
/* Generator path */
22182219
else if (PyIter_Check(blit_sequence)) {
2220+
is_generator = 1;
22192221
while ((item = PyIter_Next(blit_sequence))) {
22202222
/* Check that the item is a tuple of length 2 */
22212223
if (!PyTuple_Check(item) || PyTuple_GET_SIZE(item) != 2) {
22222224
error = FBLITS_ERR_TUPLE_REQUIRED;
2223-
Py_DECREF(item);
22242225
goto on_error;
22252226
}
22262227

@@ -2229,8 +2230,6 @@ surf_fblits(pgSurfaceObject *self, PyObject *const *args, Py_ssize_t nargs)
22292230
src_surf = PyTuple_GET_ITEM(item, 0);
22302231
blit_pos = PyTuple_GET_ITEM(item, 1);
22312232

2232-
Py_DECREF(item);
2233-
22342233
/* Check that the source is a Surface */
22352234
if (!pgSurface_Check(src_surf)) {
22362235
error = BLITS_ERR_SOURCE_NOT_SURFACE;
@@ -2262,6 +2261,8 @@ surf_fblits(pgSurfaceObject *self, PyObject *const *args, Py_ssize_t nargs)
22622261
error = BLITS_ERR_BLIT_FAIL;
22632262
goto on_error;
22642263
}
2264+
2265+
Py_DECREF(item);
22652266
}
22662267
}
22672268
else {
@@ -2272,6 +2273,9 @@ surf_fblits(pgSurfaceObject *self, PyObject *const *args, Py_ssize_t nargs)
22722273
Py_RETURN_NONE;
22732274

22742275
on_error:
2276+
if (is_generator) {
2277+
Py_XDECREF(item);
2278+
}
22752279
switch (error) {
22762280
case BLITS_ERR_SEQUENCE_REQUIRED:
22772281
return RAISE(

test/blit_test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ def blits(blit_list):
163163
self.assertEqual(dst.fblits(blit_list, 0), None)
164164
self.assertEqual(dst.fblits(blit_list, 1), dst.blits(blit_list, doreturn=0))
165165

166+
# make sure this doesn't segfault
167+
dst.fblits((dst, dst.get_rect().topleft) for _ in range(1))
168+
166169
t0 = time()
167170
results = blits(blit_list)
168171
t1 = time()

0 commit comments

Comments
 (0)