Hi there Jucers,
I’m just getting started with JUCE (and C++ more generally) and I was hoping that one of you might be able to help with my DownloadTask::Listener.
I’ve written subclassed DownloadTask::Listener with the code below.
class Mylistener : public juce::URL::DownloadTask::Listener
{
public:
void finished (juce::URL::DownloadTask *task,bool success)
{ std::cout << "Download finished!" <<std::endl; }
void progress (juce::URL::DownloadTask *task,
int64 bytesDownloaded,
int64 totalLength )
{ std::cout<< "downloaded: " << bytesDownloaded << ' of ' << totalLength << std::endl; }
};
I’m using it like this:
Mylistener ml;
url.downloadToFile(file,"",&ml);
When I run my download code without the listener, the url downloads fine. When I include the listener argument to url.downloadToFile, though, as above, I get a EXC_BAD_ACCESS error at line 62 of juce_URL.cpp ( listener->progress ( this , downloaded, contentLength);).
DownloadTask thread (30): EXC_BAD_ACCESS (code=1, address=0x18)
Does anyone know what I’m doing wrong?