Open
Description
There's currently an issue in:
[self begin];
[_renderer enqueueBlock:^
{
glReadPixels(0,0,tx,ty,GL_RGBA,GL_UNSIGNED_BYTE, buffer);
} globalSortOrder:NSIntegerMax debugLabel:@"CCRenderTexture reading pixels for new image" threadSafe:NO];
[self end];
I think that because this now uses a block, that means that when this code actually gets executed is not known. So sometimes it works, sometimes it returns an empty image, and sometimes it throws an exception because a few lines later we call free(buffer)
and buffer
then gets modified after it is freed.
We could solve this by changing the syntax to include a completion handler, but I wasn't sure if the syntax should be changing? Alternatively the change that introduced this issue could be reverted, but presumably using the renderer is more efficient.