Skip to content
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

Fix crash due to reallocation of shared indices memory #15646

merged 1 commit into from May 24, 2016


Copy link

@Rypac Rypac commented May 15, 2016

This PR provides a fix for issue #15439.

As detailed in the issue, the crash is caused by multiple references to the static __indices[] array and the invalidation of these references when this cache is expanded with realloc().

Rather than simply expanding, new memory is allocated to __indicies[] and references to any previous __indicies are captured by the QuadCommand for the duration of its lifetime. The triangle indices used by the Renderer are now guaranteed to be valid at the point copying the GL buffer.

The proposed fix will result in a slightly higher amount of memory usage whenever the shared indices buffer grows but will eventually stabilise (assuming no references to the QuadCommand are kept from deallocating).

Maybe a larger refactor for dealing with the shared memory should be considered but this is a fairly low impact fix which should at least stop the crashes!

Copy link

@ricardoquesada ricardoquesada commented May 24, 2016


@ricardoquesada ricardoquesada merged commit 23c5c18 into cocos2d:v3 May 24, 2016
1 check passed
1 check passed
Jenkins CI Build successfully!
@ricardoquesada ricardoquesada added this to the 3.12 milestone May 24, 2016
@ricardoquesada ricardoquesada self-assigned this May 24, 2016
Copy link
Contributor Author

@Rypac Rypac commented May 24, 2016

No probs!

@Rypac Rypac deleted the Rypac:fix_quadcommand_crash branch Jun 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.