Hello,
I’m having crashes on iOS whenever I instantiate a custom DownloadHandlerScript with preallocated buffer.
I sent a bug report but it has not been reproduced yet, so ou can find the complete project I use to test this here: https://drive.google.com/file/d/0B_WKsIMYzN7yLXFjaFNQNVJxMkU/view?usp=sharing
But to make it simpler, if anyone has encountered the same problem or could help me, here the relevants parts of my code:
class FileDownloader : IDisposable
{
public string Url;
public string LocalPath;
public UnityWebRequest Request;
byte[] _chunkBuffer;
public FileDownloader(string url, string localPath)
{
Url = url;
LocalPath = localPath;
Request = new UnityWebRequest(url);
_chunkBuffer = new byte[64 * 1024];
Request.downloadHandler = new ChunkDownloadHandler(_chunkBuffer);
}
// [...]
}
public class ChunkDownloadHandler : DownloadHandlerScript
{
// Pre-allocated buffer only
public ChunkDownloadHandler(byte[] buffer) : base(buffer)
{
}
// [...]
}
I’m getting the EXC_BAD_ACCESS with this stack trace:
I have reproduced this problem on Unity 5.3.4p5 and Unity 5.4.0b17
Am I doing something wrong? Has anyone encountered anything like this and figured out a way to fix it?
Thanks,
François