summaryrefslogtreecommitdiff
path: root/test/testsprite2.c
diff options
context:
space:
mode:
authorSam Lantinga <slouken@libsdl.org>2013-10-05 19:09:03 -0700
committerSam Lantinga <slouken@libsdl.org>2013-10-05 19:09:03 -0700
commitdeb0d06de77d94415d7dc62aaaf551e42e659176 (patch)
treedc925a3c1ee12b9a6f232ad6c0aff34a6517d6d4 /test/testsprite2.c
parentf50e84c7c2d47933091d49d1c783eeaa63e94bbf (diff)
Fixed bug 2132 - Tests may use invalid SDL_window pointers when windows are closed
norfanin Some of the tests keep using the pointers of a destroyed SDL_Window when the common event handling handled the close event. The event handler itself does not NULL the pointer after the destruction. The attached patch adds a loop in the handler that will assign NULL to the destroyed window. It also adds checks to some of the tests so they skip those windows by checking for NULL.
Diffstat (limited to 'test/testsprite2.c')
-rw-r--r--test/testsprite2.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/test/testsprite2.c b/test/testsprite2.c
index b40efd3f87..e0e1cf4931 100644
--- a/test/testsprite2.c
+++ b/test/testsprite2.c
@@ -360,6 +360,8 @@ main(int argc, char *argv[])
SDLTest_CommonEvent(state, &event, &done);
}
for (i = 0; i < state->num_windows; ++i) {
+ if (state->windows[i] == NULL)
+ continue;
MoveSprites(state->renderers[i], sprites[i]);
}
}