Skip to content

Commit

Permalink
[Loader] loadBytes was broken because of too narrow bytes_buf scope
Browse files Browse the repository at this point in the history
  • Loading branch information
aajanki committed Feb 28, 2013
1 parent 6b32205 commit ea02656
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/scripting/flash/display/flashdisplay.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -317,21 +317,28 @@ void LoaderThread::execute()
loaderInfo->setBytesTotal(bytes->getLength()); loaderInfo->setBytesTotal(bytes->getLength());
loaderInfo->setBytesLoaded(bytes->getLength()); loaderInfo->setBytesLoaded(bytes->getLength());


bytes_buf bb(bytes->bytes,bytes->getLength()); sbuf = new bytes_buf(bytes->bytes,bytes->getLength());
sbuf=&bb;
} }


istream s(sbuf); istream s(sbuf);
ParseThread local_pt(s,loaderInfo->applicationDomain,loaderInfo->securityDomain,loader.getPtr(),url.getParsedURL()); ParseThread local_pt(s,loaderInfo->applicationDomain,loaderInfo->securityDomain,loader.getPtr(),url.getParsedURL());
local_pt.execute(); local_pt.execute();


{ // Delete the bytes container (downloader or bytes_buf)
if (source==URL) {
//Acquire the lock to ensure consistency in threadAbort //Acquire the lock to ensure consistency in threadAbort
SpinlockLocker l(downloaderLock); SpinlockLocker l(downloaderLock);
if(downloader) if(downloader)
getSys()->downloadManager->destroy(downloader); getSys()->downloadManager->destroy(downloader);
downloader=NULL; downloader=NULL;
sbuf = NULL;
}
else if (source==BYTES)
{
delete sbuf;
sbuf = NULL;
} }

bytes.reset(); bytes.reset();


_NR<DisplayObject> obj=local_pt.getParsedObject(); _NR<DisplayObject> obj=local_pt.getParsedObject();
Expand Down

0 comments on commit ea02656

Please sign in to comment.